Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Send a get request with body #211

Open
nikitap95 opened this issue Jun 9, 2020 · 3 comments
Open

Send a get request with body #211

nikitap95 opened this issue Jun 9, 2020 · 3 comments

Comments

@nikitap95
Copy link

 Http("http://localhost:39180/api")
      .method("GET")
      .header("X", "test-app")
      .asString

is there a way to send a request body with a get request? My app functions in such way that it needs a request body to be sent..

@jyan33
Copy link

jyan33 commented Apr 16, 2021

@nikitap95 @hoffrocket I'm also looking for an answer on this too - any solutions or ideas? Something similar or equivalent to the Python version of request.get('url', json='body')

@hoffrocket
Copy link
Member

You should be able to do this:
Http(url).postData(data).method("GET").asString

Not that it’s important for method to come after postData

@alex-davies
Copy link

@hoffrocket this does not seem to work for GET. It seem to convert it into a POST when actually sending it

It works fine with other methods like DELETE though

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants