Skip to content

Commit

Permalink
fix: stop using deprecated x- header prefix
Browse files Browse the repository at this point in the history
This way of defining headers is deprecated:
https://datatracker.ietf.org/doc/html/rfc6648

Co-Authored-By: Alex Muller <[email protected]>
Co-Authored-By: Cynthia Mbulu <[email protected]>
  • Loading branch information
3 people committed Nov 20, 2023
1 parent 587295d commit fbcfc3a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/middleware-render-error-info/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Once you've mounted the middleware, if you're working locally you should now see

#### Debug headers

As well as rendering an error page, the middleware also sends an `x-error-fingerprint` HTTP header in the response. This contains the [error fingerprint](../serialize-error/README.md#serializederrorfingerprint) and is available in development and production. Inspecting this header on a generic error page can help identify the root cause of an issue.
As well as rendering an error page, the middleware also sends an `error-fingerprint` HTTP header in the response. This contains the [error fingerprint](../serialize-error/README.md#serializederrorfingerprint) and is available in development and production. Inspecting this header on a generic error page can help identify the root cause of an issue.


## Contributing
Expand Down
4 changes: 1 addition & 3 deletions packages/middleware-render-error-info/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ function createErrorRenderingMiddleware(options = {}) {

// If the error has a fingerprint, output it as a header to aid debugging in production
if (serializedError.fingerprint) {
// Note: we use x-error-fingerprint rather than ft-error-fingerprint to make
// it easier to reuse this middleware outside of FT-branded applications
response.set('x-error-fingerprint', serializedError.fingerprint);
response.set('error-fingerprint', serializedError.fingerprint);
}

// Render a full error page in non-production environments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ describe('@dotcom-reliability-kit/middleware-render-error-info', () => {
middleware(error, request, response, next);
});

it('responds with an x-error-fingerprint header', () => {
it('responds with an error-fingerprint header', () => {
expect(response.set).toBeCalledWith(
'x-error-fingerprint',
'error-fingerprint',
'mockfingerprint'
);
});
Expand Down

0 comments on commit fbcfc3a

Please sign in to comment.