type(response.code) == "string"
pfirsich opened this issue · 2 comments
Is there some particular reason for this? I noticed after switching from luasocket that some code doesn't seem to be working and that was the case, because response.code == 200 was false even though the request was successful. If the HTTP request is not malformed the status code should be a number.
I don't remember explicitly deciding to convert the response code to a string, so I think I just forgot a conversion!
The code that deals with headers and status code parsing seems pretty sketchy, so I should probably take a pass over the code and release a 3.0.0
with this fix too.
You can also maybe document the boolean return values of the function. The comment of request.send does not mention that the function can return true or false, but the code shows that both can happen. Maybe this is not the right issue to adress this, but since you mentioned you want to go over it again, this would be nice too :) Good work otherwise, thanks a lot!