Some non-200 HTTP Status codes should be supported #7

Closed
atomjack opened this Issue Mar 23, 2012 · 3 comments

Comments

2 participants
@atomjack

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.

@SaltwaterC

This comment has been minimized.

Show comment Hide comment
@SaltwaterC

SaltwaterC Mar 23, 2012

Owner

I'll attach the body to the error object. However, I'll need to take proper precautions in order to limit the buffered data.

Owner

SaltwaterC commented Mar 23, 2012

I'll attach the body to the error object. However, I'll need to take proper precautions in order to limit the buffered data.

@SaltwaterC

This comment has been minimized.

Show comment Hide comment
@SaltwaterC

SaltwaterC Apr 4, 2012

Owner

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.

Owner

SaltwaterC commented Apr 4, 2012

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.

@SaltwaterC SaltwaterC closed this in 12b5cf5 Apr 4, 2012

SaltwaterC added a commit that referenced this issue Apr 4, 2012

@atomjack

This comment has been minimized.

Show comment Hide comment
@atomjack

atomjack Apr 4, 2012

Thanks man!

atomjack commented Apr 4, 2012

Thanks man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment