Skip to content

Commit

Permalink
support for header parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
nazieb committed Apr 11, 2017
1 parent b346625 commit c9acbc4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/formatters/swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,18 @@ function getActionParams(action) {

params.push(bodyParam);
}

for (let header of request.headers) {
if (/\{.*}/g.test(header.value)) {
const headerParam = {
"name": header.name,
"in": "header",
"type": "string",
};

params.push(headerParam);
}
}
}

return params;
Expand All @@ -245,7 +257,7 @@ function mergeResourceAndActionParams(resourceParams, actionParams) {

if (actionParams.length > 0) {
for (let actionParam of actionParams) {
if (actionParam.hasOwnProperty("in") && actionParam.in == "body") {
if (actionParam.hasOwnProperty("in") && (actionParam.in == "body" || actionParam.in == "header")) {
result.push(actionParam);
continue;
}
Expand Down

0 comments on commit c9acbc4

Please sign in to comment.