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

Set response status message. #3237

Closed
sholladay opened this issue Jul 19, 2016 · 3 comments
Closed

Set response status message. #3237

sholladay opened this issue Jul 19, 2016 · 3 comments
Assignees
Labels
Milestone

Comments

@sholladay
Copy link

@sholladay sholladay commented Jul 19, 2016

In creating an h2o2 proxy, I discovered that while status codes are respected, the status message is not. This matters for proxies that wish to be very transparent, particularly for servers that wish to be more user friendly and go above and beyond the generic defaults for each HTTP response code.

Reporting this here as hapi doesn't seem to have a way to set the status message.

For example:

function mapResponseData(from, to) {
    // This copies the status code successfully.
    to.code(from.statusCode);
    // This is an example of how one might hypothetically copy
    // the status message. Doesn't currently do anything.
    to.statusMessage = from.statusMessage;
} 
function onResponse(err, inResponse, inRequest, reply) {
    const outResponse = reply('foo');
    mapResponseData(inResponse, outResponse);
}
@hueniverse
Copy link
Contributor

@hueniverse hueniverse commented Jul 19, 2016

I am not a fan of the idea of using the HTTP status message for relaying information. That said, I don't have a strong objection to providing an api such as response.message() to set it.

@hueniverse
Copy link
Contributor

@hueniverse hueniverse commented Aug 23, 2016

Closed by 0b1bf80

@hueniverse hueniverse closed this Aug 23, 2016
@sholladay
Copy link
Author

@sholladay sholladay commented Aug 23, 2016

Thank you. This helps a lot, as it is important that my proxy be transparent.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants