mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
parent
850e3139ee
commit
8b54cfea81
1 changed files with 8 additions and 1 deletions
|
@ -34,7 +34,14 @@ const http = (apiImpl) => {
|
|||
return result(req, res, next);
|
||||
}
|
||||
|
||||
res.status(apiImpl.statusCode || 200);
|
||||
let statusCode = 200;
|
||||
if (typeof apiImpl.statusCode === 'function') {
|
||||
statusCode = apiImpl.statusCode(result);
|
||||
} else if (apiImpl.statusCode) {
|
||||
statusCode = apiImpl.statusCode;
|
||||
}
|
||||
|
||||
res.status(statusCode);
|
||||
|
||||
// CASE: generate headers based on the api ctrl configuration
|
||||
res.set(shared.headers.get(result, apiImpl.headers));
|
||||
|
|
Loading…
Add table
Reference in a new issue