Skip to content

Set response status message. #3237

@sholladay

Description

@sholladay

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);
}

Metadata

Metadata

Assignees

Labels

featureNew functionality or improvement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions