Sending GET request parameters in body

2019-04-05 05:00发布

问题:

I have an API which accepts many parameters. Passing the values of the parameters will exceed the length of the url header.

I am using postman client to pass the parameters in the body but this is not working any ideas on how to make this work.

The API accepts many parameters because the backend is legacy and is exposed as an API by a service bus

回答1:

Postman doesn't allow you to send body data with get request.

Yet, if your server receives data as URL parameters you won't be able just to change the way of sending them and include them to the body (server won't accept them).

So if the length of parameters is indeed so big and the server indeed can receive the same data from body instead of from parameters then the Postman is just not the tool that you can use (maybe cURL is for you).

If your server allows to send data only as URL parameters and they are so long (more then 2000 chars What is the maximum length of a URL in different browsers?) then I think you have no chances to test this API.



回答2:

Workaround:

  1. Change the request type to POST.
  2. Set the value of your body
  3. Change request type to GET
  4. Send request and the body is included


标签: api postman