传递以字符 [ 开头的 JSON 请求会出现错误:使用 GET 操作的请求格式无效 [英] Passing JSON request starting with the character [ gives the error: invalid request format with GET operation
问题描述
当我传递以 [
开头的 JSON 请求时,我收到错误消息:GET 操作的请求格式无效.
这是我的要求.在 PostMan 中同样可以正常工作.
<预><代码>[{"equipmentNumber": "76576","systemIdentifier": "00045F063547","serialNumber": "00098",材料编号":786786"}]您的问题不完整.无论如何,我会试一试.这是一个在空手道中运行良好的测试,将其剪切并粘贴到新的Scenario
中,然后自己看看.
* url 'https://httpbin.org/post'* 要求"""[{"equipmentNumber": "76576","systemIdentifier": "00045F063547","serialNumber": "00098",材料编号":786786"}]"""* 方法贴
导致此请求的结果:
1 >发布 https://httpbin.org/post1 >接受编码:gzip,deflate1 >连接:保持活动1 >内容长度:1121 >内容类型:应用程序/json;字符集=UTF-81 >主持人:httpbin.org1 >用户代理:Apache-HttpClient/4.5.5 (Java/1.8.0_231)[{"equipmentNumber":"76576","systemIdentifier":"00045F063547","serialNumber":"00098","materialNumber":"786786"}]
因此,如果您仍然被卡住,请按照以下过程进行操作 - 否则没有人可以帮助您解决问题中缺乏信息的问题:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
When I pass a JSON request starting with [
, I get the error which says: invalid request format with GET operation.
Here is my request. The same works fine in PostMan.
[
{
"equipmentNumber": "76576",
"systemIdentifier": "00045F063547",
"serialNumber": "00098",
"materialNumber": "786786"
}
]
Your question is incomplete. Anyway I'll give it a shot. Here is a test that works perfectly fine in Karate, cut and paste it into a new Scenario
and see for yourself.
* url 'https://httpbin.org/post'
* request
"""
[
{
"equipmentNumber": "76576",
"systemIdentifier": "00045F063547",
"serialNumber": "00098",
"materialNumber": "786786"
}
]
"""
* method post
Which results in this request:
1 > POST https://httpbin.org/post
1 > Accept-Encoding: gzip,deflate
1 > Connection: Keep-Alive
1 > Content-Length: 112
1 > Content-Type: application/json; charset=UTF-8
1 > Host: httpbin.org
1 > User-Agent: Apache-HttpClient/4.5.5 (Java/1.8.0_231)
[{"equipmentNumber":"76576","systemIdentifier":"00045F063547","serialNumber":"00098","materialNumber":"786786"}]
So if you are still stuck, follow this process - else no one can help you with the lack of information in your question: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
这篇关于传递以字符 [ 开头的 JSON 请求会出现错误:使用 GET 操作的请求格式无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!