Getting `Cannot mix POST with other methods` error when using `ab -p` Getting `Cannot mix POST with other methods` error when using `ab -p` unix unix

Getting `Cannot mix POST with other methods` error when using `ab -p`


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)