Skip to content

Commit

Permalink
chore(release): 2.1.0 [skip ci]
Browse files Browse the repository at this point in the history
# [2.1.0](v2.0.3...v2.1.0) (2020-11-24)

### Features

* **api:** add route link to headers in api responses ([804ef56](804ef56))
  • Loading branch information
semantic-release-bot committed Nov 24, 2020
1 parent 804ef56 commit 117d60f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [2.1.0](https://github.com/ClearC2/headlamp/compare/v2.0.3...v2.1.0) (2020-11-24)


### Features

* **api:** add route link to headers in api responses ([804ef56](https://github.com/ClearC2/headlamp/commit/804ef564be9e292262a82ce273ca282825f846dd))

## [2.0.3](https://github.com/ClearC2/headlamp/compare/v2.0.2...v2.0.3) (2020-02-12)


Expand Down
11 changes: 6 additions & 5 deletions lib/api-route-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ function _default(app) {
var responses = getAllRouteResponses(route.id);
var respId = responseStore.getActivatedResponseId(route.id);

if (route.filename) {
res.set('X-Headlamp-Route-File', route.filename);
}

res.set('X-Headlamp-Route-Link', "".concat(req.headers.origin, "/_docs/request/").concat(route.id));

if (respId !== undefined) {
var resp = responses[respId];
var response = callIfFunc(resp);
Expand All @@ -81,11 +87,6 @@ function _default(app) {
}

var firstResponse = callIfFunc(responses[0] || {});

if (route.filename) {
res.set('X-Headlamp-Route-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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@clearc2/headlamp",
"version": "2.0.3",
"version": "2.1.0",
"description": "Express API documenter",
"main": "lib/index.js",
"publishConfig": {
Expand Down

0 comments on commit 117d60f

Please sign in to comment.