Donshon
Donshon

Reputation: 174

Jmeter returning 400 bad request on a perfectly valid GET request

I have a valid HTTP GET request which is returning a 200 OK on both curl and postman, however, when run in Jmeter it keeps returning a 400 bad Request with a response body as follows

<HTML><HEAD>
<TITLE>Invalid URL</TITLE>
</HEAD><BODY>
<H1>Invalid URL</H1>
The requested URL "&#91;no&#32;URL&#93;", is invalid.<p>
Reference&#32;&#35;9&#46;2ea93d42&#46;1511385794&#46;51815e
</BODY></HTML>

Not sure what am i doing wrong?

Upvotes: 1

Views: 5384

Answers (4)

Just put HTTP Header Manager above your request and add this:

Content-Type : application/x-www-form-urlencoded

Upvotes: 0

Preethi
Preethi

Reputation: 31

I faced the same issue and i added the baseURL value to the 'Host' parameter in Header section.

eg: if your site's baseURL is "http://test.com".

In Header manager section -> add Host: test.com

Upvotes: 2

Donshon
Donshon

Reputation: 174

Alright, so I figured it out. For some odd reason when I put the whole url string in the "path" field, the test works as expected i.e. returns a 200. Don't ask me why that is, perhaps something for Apache folks to answer.

Upvotes: 0

UBIK LOAD PACK
UBIK LOAD PACK

Reputation: 34526

Ensure you add a Header Manager as child of your HTTP Request and add headers:

Content-Type : application/json

Upvotes: 1

Related Questions