Skip to content

Commit

Permalink
fix: remove use of the deprecated OutgoingMessage.prototype._headers
Browse files Browse the repository at this point in the history
Removes deprecated code. Cannot replace with setHeaders since headers already sent.
In case you still want to obscure the headers from the request-object i suggest you strip down the request object to only include desired attributes, rather than changing the original object.

Co-authored-by: Marco Link <marco.link@contentful.com>
Co-authored-by: Makinwa Olubukola <bukola.makinwa@contentful.com>
  • Loading branch information
3 people committed Sep 9, 2021
1 parent 48cc8b6 commit 257d4e7
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/contentful.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ function obscureAuthTokenInResponse (http) {

error.response.config.headers.Authorization = error.response.config.headers.Authorization.replace(token, `Bearer...${token.substr(-5)}`)

if (error.response.request._headers && error.response.request._headers.authorization) {
error.response.request._headers.authorization = error.response.request._headers.authorization.replace(token, `Bearer...${token.substr(-5)}`)
}

if (error.response.request._header) {
error.response.request._header = error.response.request._header.replace(token, `Bearer...${token.substr(-5)}`)
}
Expand Down

0 comments on commit 257d4e7

Please sign in to comment.