在正文中发送 GET 请求参数 [英] Sending GET request parameters in body

查看:51
本文介绍了在正文中发送 GET 请求参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以接受许多参数的 API.传递参数的值会超过 URL Header 的长度.

我正在使用 Postman 客户端在正文中传递参数,但这没有就如何使其工作有任何想法.

API 接受许多参数,因为后端是遗留的,并且通过服务总线作为 API 公开.

解决方案

旧版本的 Postman 不允许您使用 get 请求发送 body 数据.

然而,如果您的服务器接收数据作为 URL 参数,您将无法仅更改发送它们的方式并将它们包含在正文中(服务器不会接受它们).

因此,如果参数的长度确实如此之大,并且服务器确实可以从 body 而不是从参数中接收相同的数据,那么 Postman 就不是您可以使用的工具(也许 cURL 适合您).

如果您的服务器只允许将数据作为 URL 参数发送并且它们很长(超过 2000 个字符 不同浏览器中一个 URL 的最大长度是多少?) 那么我认为你没有机会测试这个 API.

更新:新版本 7.20.1 现在允许使用 GET 请求发送正文

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.

解决方案

Older versions of Postman didn'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.

UPDATE: new Version 7.20.1 now allows to send Body with GET request

这篇关于在正文中发送 GET 请求参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆