0

我正在尝试发布以下内容,但我不断收到错误消息:

“http:错误:参数 REQUEST_ITEM:“with”不是有效值”

http POST https://someurl.com fields:='{\"example-api-identifier\":\"String with spaces\"}' Token:randomnumbers

我如何逃离这些空间?我假设这是这里的问题?

4

1 回答 1

0

我个人不了解 powershell,但是 httpie 应该可以使用空格而不需要 := 语法

$ http POST http://httpbin.org/post example-api-identifier="String with spaces"

产量

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: close
Content-Length: 413
Content-Type: application/json
Date: Sat, 01 Feb 2020 00:25:41 GMT
Server: gunicorn/19.9.0

{
    "args": {},
    "data": "{\"example-api-identifier\": \"String with spaces\"}",
    "files": {},
    "form": {},
    "headers": {
        "Accept": "application/json, */*",
        "Accept-Encoding": "gzip, deflate",
        "Connection": "keep-alive",
        "Content-Length": "48",
        "Content-Type": "application/json",
        "Host": "httpbin.org",
        "User-Agent": "HTTPie/1.0.0"
    },
    "json": {
        "example-api-identifier": "String with spaces"
    },
    "origin": "127.0.0.1",
    "url": "http://httpbin.org/post"
}
于 2020-02-01T00:28:55.167 回答