Get requests with body

k6 v0.26.1

I have an GET API call with a body payload and headers
http.get call seems to only consider params (headers)

How can I make a successful call?

Hi @paomegalul,

GET requests usually don’t need body, but if your API requires it, you can use the general http.request method. See docs: request( method, url, [body], [params] )


let requestData = {"key": "value"};

res = http.request('GET', '', requestData, {
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
1 Like

Thank you so much sir. This worked out perfectly for me