guardian/httpie-hmac-auth

Correct POST Syntax to send JSON Body

lbindal opened this issue · 0 comments

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
}