Post requests not functioning properly
See original GitHub issueDescription of issue
Locust v0.11.0 appears to be using GET requests even though locust file specifies to use a post request
Expected behavior
Post request made to specified URI
Actual behavior
Get request is made instead
Environment settings
- OS: Debian devirative
- Python version: 3.6.8
- Locust version: 0.11.0
Steps to reproduce (for bug reports)
#!/usr/bin/env python3
import json
from locust import HttpLocust, TaskSet, task
headers = {
"Host": "host.host.net",
"User-Agent":
"Mozilla/5.0 (X11; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0",
"Accept": "application/json, text/plain, */*",
"Accept-Language": "en-US,en;q=0.5",
"Accept-Encoding": "gzip, deflate, br",
"Content-Type": "application/json;charset=utf-8",
"Authorization":
"REDACTED",
"refreshTokenId": "REDACTED",
"Content-Length": "49",
"Connection": "keep-alive",
}
data = {"UserID": "REDACTED"}
def info(l):
response = l.client.post("/api/",
data=data,
headers=headers)
print(response)
print(response.text)
print(response.status_code)
class UserBehavior(TaskSet):
tasks = {info: 1}
class MyLocust(HttpLocust):
task_set = UserBehavior
min_wait = 5000
max_wait = 15000
Sample of the logs
[2019-06-18 16:09:07,290] Eris/INFO/locust.runners: All locusts hatched: MyLocust: 5
[2019-06-18 16:09:07,303] Eris/INFO/stdout: <Response [405]>
[2019-06-18 16:09:07,304] Eris/INFO/stdout:
[2019-06-18 16:09:07,304] Eris/INFO/stdout: {"message":"The requested resource does not support http method 'GET'."}
[2019-06-18 16:09:07,304] Eris/INFO/stdout:
[2019-06-18 16:09:07,304] Eris/INFO/stdout: 405
[2019-06-18 16:09:07,304] Eris/INFO/stdout:
[2019-06-18 16:09:15,109] Eris/ERROR/stderr: KeyboardInterrupt
[2019-06-18 16:09:15,110] Eris/ERROR/stderr: 2019-06-18T20:09:15Z
[2019-06-18 16:09:15,110] Eris/ERROR/stderr:
[2019-06-18 16:09:15,110] Eris/INFO/locust.main: Shutting down (exit code 0), bye.
[2019-06-18 16:09:15,110] Eris/INFO/locust.main: Cleaning up runner...
[2019-06-18 16:09:15,127] Eris/INFO/locust.main: Running teardowns...
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (2 by maintainers)
Top Results From Across the Web
Django POST request not working correctly - Stack Overflow
The problem with this is the POST request is sent when run, but the data is not saved to the database and I...
Read more >Django POST request not working correctly. - Reddit
Django POST request not working correctly. I'm having a problem related to a Django project I'm working on where I have a simple...
Read more >POST request not properly authenticated error? (Get Request ...
I'm trying to figure out why I get an error saying “This request is not properly authenticated” when trying out the following command?...
Read more >POST request not working in Power BI (but working
Hello, I subscribe to data feeds from a vendor that I have to integrate into Power BI but they use POST (not GET)...
Read more >WSGIDaemonProcess — mod_wsgi 4.9.4 documentation
In general such deadlock problems would not arise with well behaved WSGI applications, but some spam bots attempting to post data to web...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So the server was issuing a redirect. It was only at the apache level. It was a http vs https issue.
Confusing things further was CURL. It doesn’t change the verb to GET but continues to use POST. Postman on the other hand does what locust does and moves to GET if POST gets redirected.
I’ve read up on it a little and it the different behaviours among different tech is frustrating and there are good points for both. Hopefully this comment is found and helps someone else.
Im unsure on whether locust should log a GET or a POST. It feels like it should do… something.
Right now it logs a POST even if it ends up performing a GET.
In case it’s not clear from @richkettle’s comment, if you are encountering this issue try switching your target url from using http to using https. This worked in my case.