codesenberg / bombardier

Fast cross-platform HTTP benchmarking tool written in Go
MIT License
6.06k stars 317 forks source link

How can I send a basic post request with headers and a json body? #94

Closed Leonardo-Ferreira closed 1 year ago

Leonardo-Ferreira commented 2 years ago
bombardier -c 1 -m POST -b "{\"refreshToken\": \"abc\"}" -H "Content-length: 23" -H "Content-Type : application/json; charset=utf-8" -H "X-JWT-Assertion : a very long JWT here" -n 1 http://myApi.com/MyOperation

executing this I get a 400...

if I copy/paste these values to postman, it works as expected...

codesenberg commented 1 year ago

-H "Content-Type : application/json; charset=utf-8" -H "X-JWT-Assertion : a very long JWT here" You have extra spaces after Content-Type and X-JWT-Assertion. Pretty sure this is why server is rejecting your request. If this is not the case, please paste full output from bombardier and your server's log, if you re-open this issue.