Skip to content

Commit

Permalink
fix the failure to parse req.swagger.query
Browse files Browse the repository at this point in the history
  • Loading branch information
lanchongyizu committed May 15, 2018
1 parent a01e8a0 commit e6d5932
Show file tree
Hide file tree
Showing 5 changed files with 10,833 additions and 3,290 deletions.
2 changes: 1 addition & 1 deletion lib/services/profile-api-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ function profileApiServiceFactory(
}
})
.then(function() {
var macs = req.query.mac || req.query.macs;
var macs = query.mac || query.macs;
if (macs) {
var macAddresses = self.getMacs(macs);
var options = {
Expand Down
6 changes: 3 additions & 3 deletions lib/services/swagger-api-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ function swaggerFactory(
function _parseQuery(req) {
req.swagger.query = _(req.swagger.params)
.pick(function(param) {
if (param.parameterObject) {
return param.parameterObject.in === 'query' &&
if (param.schema) {
return param.schema.in === 'query' &&
param.value !== undefined;
}
return false;
})
.mapValues(function(param) {
req.query = _(req.query).omit(param.parameterObject.definition.name).value();
req.query = _(req.query).omit(param.schema.name).value();
return param.value;
}).value();
}
Expand Down
Loading

0 comments on commit e6d5932

Please sign in to comment.