I'm using ApacheBench (ab
) to stress test my site. When I specify a method -m POST
and some postdata -p {datafile}
, I get the message
Cannot mix POST with other methods.
The trouble is that I'm not actually mixing POST with other methods. Here's my full command:
ab -m POST -p postdata.txt -n 1000 -c 100 http://example.com/
This is due to an idiosyncrasy in the way ab
handles command-line arguments. When you use -p
it automatically sets the method to POST
for you, and this happens before -m
is parsed. So when it parses -m
, it sees that the already set method is not null and throws an error. What it should do (IMO) is silently ignore the parameter if its value is the same as what's implicitly been set.
Note that everything above also applies when you try to do a PUT
request; e.g., ab -m PUT -u putdata.txt
.
So what you should do to avoid this error is never specify -m
when you're using -p
or -u
.
(Source: the ab.c
source file)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With