传递以字符[开头的JSON请求会产生错误:GET操作无效的请求格式 [英] Passing JSON request starting with the character [ gives the error: invalid request format with GET operation

查看:55
本文介绍了传递以字符[开头的JSON请求会产生错误:GET操作无效的请求格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我传递以 [开头的JSON请求时,出现错误消息:GET操作无效的请求格式.

When I pass a JSON request starting with [, I get the error which says: invalid request format with GET operation.

这是我的要求.在PostMan中也可以正常工作.

Here is my request. The same works fine in PostMan.

[
  {
    "equipmentNumber": "76576",
    "systemIdentifier": "00045F063547",
    "serialNumber": "00098",
    "materialNumber": "786786"
  }
]

推荐答案

您的问题不完整.无论如何,我会试一试.这是一项在空手道中工作得很好的测试,将其剪切并粘贴到新的 Scenario 中,然后亲自查看.

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

此请求的结果:

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屋!

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