Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReasonPhrase not returned properly #64

Closed
pantelisk73 opened this issue Jun 5, 2014 · 8 comments
Closed

ReasonPhrase not returned properly #64

pantelisk73 opened this issue Jun 5, 2014 · 8 comments

Comments

@pantelisk73
Copy link

I have a ASP.NET MVC service that is returning an HttpStatusResult of 500 with a custom error phrase (Invalid User Name to be exact). When I use the NativeMessageHandler, the ReasonPhrase property of the HttpResponseMessage always shows "Internal Server Error" and never my status description.

If I comment out the use of the NativeMessageHandler, the vanilla handler that comes with the HttpClient does return the correct status description (as sent from the server).

Please advise :(

@anaisbetts
Copy link
Owner

@pantelisk73 At the moment, you can read the content body to get the same result, but this is indeed a bug vs. what HttpClient does (though I'd argue that HttpClient is wrong, as many APIs return JSON on error)

@pantelisk73
Copy link
Author

The body unfortunately contains some random message...

The page cannot be displayed because an internal server error has occurred.

Which is not what the server returns as the reason phrase. :( Any chance of getting this fixed. I was using 1.2.1 and it must have worked then. Seems to have broken in 2.0.1

@anaisbetts
Copy link
Owner

Oh wait, you're right - I misread a blog post that described where ReasonPhrase came from. I would certainly take a PR to fix this

@pantelisk73
Copy link
Author

Any idea when?

@anaisbetts
Copy link
Owner

Whenever you write it :)

@Cheesebaron
Copy link
Contributor

Never ask for ETA's on OSS. Whenever you do that the release date is shoved back further just to teach you.

@rogihee
Copy link
Contributor

rogihee commented Oct 6, 2014

            var ret = new HttpResponseMessage((HttpStatusCode)resp.Code());
            ret.ReasonPhrase = resp.Message();

in OkHttpNetworkHandler, AFAICT fixes it or worksforme.

@marktaling
Copy link

Sadly the issue still exists in the iOS version :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants