Skip to content

Commit

Permalink
feat(api): added server filename as res header
Browse files Browse the repository at this point in the history
  • Loading branch information
dadamssg committed Jul 26, 2018
1 parent ac5ca94 commit 9ca89ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/api-route-provider.js
Expand Up @@ -69,6 +69,9 @@ var _default = function _default(app) {
return res.json(route.response);
}
var firstResponse = callIfFunc(responses[0] || {});
if (route.filename) {
res.set('X-headlamp-server-file', route.filename);
}
return res.status(firstResponse.status || 500).json(firstResponse.response || 'No response defined.');
});
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "headlamp",
"version": "0.2.3",
"version": "0.3.0",
"description": "Express API documenter",
"main": "lib/index.js",
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions src/api-route-provider.js
Expand Up @@ -32,6 +32,9 @@ export default function (app, options = {}) {
return res.json(route.response)
}
const firstResponse = callIfFunc(responses[0] || {})
if (route.filename) {
res.set('X-headlamp-server-file', route.filename)
}
return res
.status(firstResponse.status || 500)
.json(firstResponse.response || 'No response defined.')
Expand Down

0 comments on commit 9ca89ff

Please sign in to comment.