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

HTTP reason phrase is omitted from responses #20

Closed
alyssais opened this issue Jul 15, 2017 · 3 comments
Closed

HTTP reason phrase is omitted from responses #20

alyssais opened this issue Jul 15, 2017 · 3 comments

Comments

@alyssais
Copy link
Contributor

The HTTP 1.1 RFC defines a response status line like this:

Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF

However, since Mockito switched to constructing HTTP responses manually, instead of through Hyper, it has omitted the reason phrase (and indeed has no way of setting it without either modifying the API to require it being specified by the user, or maintaining an internal mapping of status codes to reason phrases like Hyper does). This means that correctly implemented HTTP clients may fail to parse responses generated by Mockito. Hyper itself is one of these clients that can't understand Mockito responses.

@lipanski
Copy link
Owner

the RFC does state:

The Status-Code is intended for use by automata and the Reason-Phrase is intended for the human user. The client is not required to examine or display the Reason-Phrase.

...but I'll see what I can do to fix this. most probably I'll append the reason based on an internal mapping so I don't have to break the current interface.

@alyssais
Copy link
Contributor Author

alyssais commented Jul 15, 2017

the RFC does state:

The Status-Code is intended for use by automata and the Reason-Phrase is intended for the human user. The client is not required to examine or display the Reason-Phrase.

Sure, but it's still a mandatory part of the status line — even if a parser just skips over it, it can still expect it to be there.

Thanks in advance for looking into this. :) One thing you could do would be to just return the same static string all the time, since a client is unlikely to depend on the value, but there does need to be something there to be valid HTTP.

@lipanski
Copy link
Owner

I guess I misinterpreted that. in any case, 0.8.1 fixes it.
as always, thanks for reporting 🥇

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

2 participants