codesenberg / bombardier

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

body not allowed for GET #86

Closed leberknecht closed 1 year ago

leberknecht commented 2 years ago

This is an example of what a bug report can look like. Please, feel free to also provide any other information relevant to the issue.

What version of bombardier are you using?

% bombardier --version
bombardier version unspecified linux/amd64

I just installed now via go get -u github.com/codesenberg/bombardier ..so i guess thats 9376ab4 then?

What operating system and processor architecture are you using (if relevant)?

% uname -a
Linux <snip> 5.13.19-2-MANJARO #1 SMP PREEMPT Sun Sep 19 21:31:53 UTC 2021 x86_64 GNU/Linux

What did you do?

I want to stress-test my elasticsearch server while running an index-update to see how many non-200 responses i get while closing/changing/opening-again the index. For that i want bombardier running a search (which is a GET-with-body request) while triggering an index-update in another shell.

What you expected to happen?

Allow me to send a payload with a GET request

What actually happened?

 % bombardier -c125 -l  -H 'Content-type: application/json' -b '{"from": 0, "size": 10, "query": {"match_all": {}}}' 'http://elastic:elastic@elasticsearch:9200/watchlist_record/_search?pretty'
GET and HEAD requests cannot have body

Thats technically not correct, it always was ok the send a body with a GET request, it just shouldnt be used. But as mentioned here: https://stackoverflow.com/questions/978061/http-get-with-request-body that is also obsolete by now. curl for example allows to specify a body along with a GET request. If there is no special reason why this should not work with bombardier, i would love to see this also being allowed :) Shall we change

- cantHaveBody = []string{"GET", "HEAD"}
+ cantHaveBody = []string{"HEAD"}

?

codesenberg commented 1 year ago

Very interesting. Seems like a simple change. I'll look into incorporating it into one of the coming releases.