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