Web Service HTTP GET fails with Status Code 400


#1

When I send a simple HTTP GET request to https://my-uat.xxx.com, it returns status code 400. I created the new request in the Object Repository and have tried executing it on its own as well as part of a script. I get the same 400 status when writing Groovy code using RequestObject and ResponseObject.

Here is the code I have used:

String requestMethod = ‘GET’
String endpoint = ‘https://my-uat.xxxxxxxxxx.com
String authHeader = ‘’

TestObjectProperty header_ContentType = new TestObjectProperty(‘Content-Type’, ConditionType.EQUALS, ‘text/html; charset=utf-8’)

TestObjectProperty header_Accept = new TestObjectProperty(‘Accept’, ConditionType.EQUALS, ‘text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8’)

TestObjectProperty header_Authorization = new TestObjectProperty(‘Authorization’, ConditionType.EQUALS, authHeader)

not_run: TestObjectProperty header_Cookies = new TestObjectProperty(‘Cookie’, ConditionType.EQUALS, cookies)

ArrayList defaultHeader = Arrays.asList(header_ContentType, header_Accept)

RequestObject ro = new RequestObject()
ro.setRestUrl(endpoint)
ro.setHttpHeaderProperties(defaultHeader)
ro.setRestRequestMethod(requestMethod)

ResponseObject resp = WS.sendRequest(ro)
println(resp.getStatusCode())

Using Advanced Rest Client and Postman, the same HTTP GET request returns status code 200.

I am open to suggestions.