Skip to content

Commit 09c2e33

Browse files
committed
Prevent error headers from being modified. Closes hapijs#3378
1 parent 4596dd9 commit 09c2e33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/transmit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ internals.marshal = function (request, next) {
110110

111111
internals.fail = function (request, boom, callback) {
112112

113-
const error = Hoek.clone(boom.output);
113+
const error = boom.output;
114114
const response = new Response(error.payload, request);
115115
response._error = boom;
116116
response.code(error.statusCode);
117-
response.headers = error.headers;
117+
response.headers = Hoek.clone(error.headers); // Prevent source from being modified
118118
request.response = response; // Not using request._setResponse() to avoid double log
119119

120120
internals.marshal(request, (err) => {

0 commit comments

Comments
 (0)