Python version 3.6.5
Asks version 2.3.6
Trio version 0.13.0
I was using asks.Session to make async requests to a server. By accident I was using http instead of https to make the calls which was causing redirects from http --> https. Because it was a redirect the response status code was 308. The method I was using was a POST method, however it was getting overwritten by the client to be a GET.
Based on these lines only status codes 301 and 305 set the variable force_get to be False. All other 3xx error codes besides 301, 305, and 303 end up getting force_get set to be True. Because of this, on this line it overwrites the method we are sending so a POST becomes a GET. This was causing my code to fail because the GET method was not supported on that endpoint. This line should probably be modified to include 308, which states, "The request method and the body will not be altered", and 307 which states, "The method and the body of the original request are reused to perform the redirected request."
Python version 3.6.5
Asks version 2.3.6
Trio version 0.13.0
I was using
asks.Sessionto makeasyncrequests to a server. By accident I was usinghttpinstead ofhttpsto make the calls which was causing redirects fromhttp-->https. Because it was a redirect the response status code was308. The method I was using was aPOSTmethod, however it was getting overwritten by the client to be aGET.Based on these lines only status codes
301and305set the variableforce_getto beFalse. All other3xxerror codes besides301,305, and303end up gettingforce_getset to beTrue. Because of this, on this line it overwrites the method we are sending so aPOSTbecomes aGET. This was causing my code to fail because theGETmethod was not supported on that endpoint. This line should probably be modified to include 308, which states, "The request method and the body will not be altered", and 307 which states, "The method and the body of the original request are reused to perform the redirected request."