Skip to content
This repository has been archived by the owner on May 12, 2022. It is now read-only.

Correct POST Syntax to send JSON Body #5

Open
lbindal opened this issue Jul 10, 2020 · 0 comments · May be fixed by #6
Open

Correct POST Syntax to send JSON Body #5

lbindal opened this issue Jul 10, 2020 · 0 comments · May be fixed by #6

Comments

@lbindal
Copy link

lbindal commented Jul 10, 2020

What is the correct syntax to send post with JSON?

When I send POST with body
echo '{"hello": "world"}' | http POST http://localhost:8080/ --auth-type=hmac --auth 'username:password'
http: error: TypeError: sequence item 1: expected str instance, bytes found
The above syntax works fine with other authentication plugins)

When I SEND POST without body it complains that body is missing
http POST http://localhost:8080/ --auth-type=hmac --auth 'username:password'

GET WORKS FINE
http GET http://localhost:8080/ --auth-type=hmac --auth='client:secret'
HTTP/1.1 200
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: application/json;charset=UTF-8
Date: Fri, 10 Jul 2020 10:44:40 GMT
Expires: 0
Pragma: no-cache
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block

{
"auth_details": "HMAC client:YsQoZJGbtb3ksxuMdayD0vySl2wTx26ahRtLCr/+4pw=",
"body_info": null,
"host_info": "localhost:8080",
"id": 5,
"method_info": "GET",
"path_info": "/",
"protocol_info": "http",
"query_params": null
}

@BoboTiG BoboTiG linked a pull request Jun 4, 2021 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant