Skip to content

Commit 0022a1c

Browse files
robin-drexlerdmbch
authored andcommitted
fix(react): always respect headers, even on a miss
This allows applications to always add headers THIS IS A BREAKING CHANGE
1 parent ebc0c37 commit 0022a1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/react/node.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,16 @@ var renderWithContext = function(reactElement, _context) {
106106
timings.end('hops.react.renderTemplate');
107107

108108
var routerContext = templateData.routerContext;
109+
routerContext.headers && res.set(routerContext.headers);
110+
109111
if (routerContext.miss) {
110112
next();
111113
} else if (routerContext.url) {
112114
res.status(routerContext.status || 301);
113115
res.set('Location', routerContext.url);
114-
routerContext.headers && res.set(routerContext.headers);
115116
res.end();
116117
} else {
117118
res.status(routerContext.status || 200);
118-
routerContext.headers && res.set(routerContext.headers);
119119
res.type('html');
120120
res.send(markup);
121121
}

0 commit comments

Comments
 (0)