Return text/plain if html isn't explicitly specified in Accept header
This commit is contained in:
parent
24ed412f50
commit
e2293900de
10
server.js
10
server.js
|
@ -141,9 +141,13 @@ app.use(connect_st({
|
|||
// Then we can loop back - and everything else should be a token,
|
||||
// so route it back to /
|
||||
app.use(route(function(router) {
|
||||
router.get('/:id', function(request, _response, next) {
|
||||
request.sturl = '/';
|
||||
next();
|
||||
router.get('/:id', function(request, response, next) {
|
||||
if (request.headers.accept.includes('html')) {
|
||||
request.sturl = '/';
|
||||
next();
|
||||
} else {
|
||||
return raw(request, response);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
|
|
Loading…
Reference in New Issue