Skip to content
Snippets Groups Projects
Commit c9f175da authored by Rhys Arkins's avatar Rhys Arkins
Browse files

refactor: redact gotOptions

parent 514d527d
No related branches found
No related tags found
No related merge requests found
......@@ -15,5 +15,12 @@ function errSerializer(err) {
if (err.stack) {
response.stack = err.stack;
}
if (
err.gotOptions &&
err.gotOptions.headers &&
err.gotOptions.headers.authorization
) {
response.gotOptions.headers.authorization = '** redacted **';
}
return response;
}
......@@ -5,6 +5,11 @@ Object {
"a": 1,
"b": 2,
"body": "some response body",
"gotOptions": Object {
"headers": Object {
"authorization": "** redacted **",
},
},
"message": "some message",
"response": Object {
"body": "some response body",
......
......@@ -9,6 +9,11 @@ describe('logger/err-serializer', () => {
response: {
body: 'some response body',
},
gotOptions: {
headers: {
authorization: 'Bearer abc',
},
},
};
expect(configSerializer(err)).toMatchSnapshot();
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment