Skip to content
Permalink
Browse files

feat(api): added server filename as res header

  • Loading branch information...
dadamssg committed Jul 26, 2018
1 parent ac5ca94 commit 9ca89ff35b8c6a033f7722b403fc080b98eb4f09
Showing with 7 additions and 1 deletion.
  1. +3 −0 lib/api-route-provider.js
  2. +1 −1 package.json
  3. +3 −0 src/api-route-provider.js
@@ -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.');
});
});
@@ -1,6 +1,6 @@
{
"name": "headlamp",
"version": "0.2.3",
"version": "0.3.0",
"description": "Express API documenter",
"main": "lib/index.js",
"scripts": {
@@ -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.')

0 comments on commit 9ca89ff

Please sign in to comment.
You can’t perform that action at this time.