Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Some non-200 HTTP Status codes should be supported #7
I noticed that http-get only returns results if the HTTP status code is 200. For some status codes (like 400 & 403), per the HTTP/1.1 spec, more information can be returned in the body. I'm seeing this with doing calls to last.fm's API - if you pass some incorrect data (wrong username or password), the HTTP code is 403 but it also includes valid XML describing the error. As is, the http-get library ends up not getting any of this content. Could some of these error codes be included along with 200?
I was able to get it to work by using a local copy and adding case statements for the two codes I gave above, but I'm developing a small API I'd like to share and would love it if the latest version supported these.
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
The status codes definitions don't specify for every case if the body must contain something, something, etc. Anyway, I don't have the time for reading the whole RFC2616, therefore I'll add all the 4xx errors to this functionality. I'm going to limit the buffered data to 1MiB though in order to avoid unpleasant surprises.
If you have any suggestions, please add them here.