Skip to content

Commit

Permalink
FIX: issue #917 (#935)
Browse files Browse the repository at this point in the history
Co-authored-by: Dušan Miška <dusan.miska@lucis.si>
  • Loading branch information
dusanmi and DMLucis authored Aug 4, 2024
1 parent 2d75db4 commit 8e66d3f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/middlewares/parsers/req.parameter.mutator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class RequestParameterMutator {
const i = req.originalUrl.indexOf('?');
const queryString = req.originalUrl.substr(i + 1);

if (parameter.in === 'query' && !parameter.allowReserved) {
if (parameter.in === 'query' && !parameter.allowReserved && parameter.explode === true) {
this.validateReservedCharacters(name, rawQuery);
}

Expand All @@ -94,7 +94,15 @@ export class RequestParameterMutator {
} else if (type === 'array' && !explode) {
const delimiter = ARRAY_DELIMITER[parameter.style];
this.validateArrayDelimiter(delimiter, parameter);
this.parseJsonArrayAndMutateRequest(req, parameter.in, name, delimiter);
if (parameter.in === "query") {
const field = REQUEST_FIELDS[parameter.in];
const vs = rawQuery.get(name);
if (vs) {
req[field][name] = vs[0].split(delimiter).map(v => decodeURIComponent(v));
}
} else {
this.parseJsonArrayAndMutateRequest(req, parameter.in, name, delimiter);
}
} else if (type === 'array' && explode) {
this.explodeJsonArrayAndMutateRequest(req, parameter.in, name);
} else if (style === 'form' && explode) {
Expand Down

0 comments on commit 8e66d3f

Please sign in to comment.