Skip to content

Commit

Permalink
chore: release 11.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Inksprout committed Jun 14, 2022
1 parent a06eec7 commit e40b9ac
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
Binary file added .DS_Store
Binary file not shown.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# [11.1.0](https://github.com/pactflow/swagger-mock-validator/compare/11.0.0...11.1.0) (2022-06-14)


### Bug Fixes

* Convert pact spec 3 headers to v1 format ([a0584b0](https://github.com/pactflow/swagger-mock-validator/commit/a0584b0590a5a857cb1bfa302595e892aee781ab))



<a name="11.0.0"></a>
# [11.0.0](https://github.com/pactflow/swagger-mock-validator/compare/10.3.0...11.0.0) (2022-04-22)

Expand Down
12 changes: 10 additions & 2 deletions dist/swagger-mock-validator/mock-parser/pact/pact-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ const parseValues = (values, location, parentInteraction) => {
return result;
}, {});
};
const parseHeaders = (headers, location, parentInteraction) => {
for (const key in headers) {
if (typeof headers[key] !== 'string') {
headers[key] = headers[key].toString();
}
}
return parseValues(headers, location, parentInteraction);
};
const isPactV1RequestQuery = (query) => typeof query === 'string';
const parseAsPactV1RequestQuery = (requestQuery) => {
const parsedQueryAsStringsOrArrayOfStrings = querystring.parse(requestQuery);
Expand Down Expand Up @@ -76,7 +84,7 @@ const parseInteraction = (interaction, interactionIndex, mockPathOrUrl) => {
parentInteraction: parsedInteraction,
value: interaction.request.body
};
parsedInteraction.requestHeaders = parseValues(interaction.request.headers, `${parsedInteraction.location}.request.headers`, parsedInteraction);
parsedInteraction.requestHeaders = parseHeaders(interaction.request.headers, `${parsedInteraction.location}.request.headers`, parsedInteraction);
parsedInteraction.requestMethod = {
location: `${parsedInteraction.location}.request.method`,
parentInteraction: parsedInteraction,
Expand All @@ -94,7 +102,7 @@ const parseInteraction = (interaction, interactionIndex, mockPathOrUrl) => {
parentInteraction: parsedInteraction,
value: interaction.response.body
};
parsedInteraction.responseHeaders = parseValues(interaction.response.headers, `${parsedInteraction.location}.response.headers`, parsedInteraction);
parsedInteraction.responseHeaders = parseHeaders(interaction.response.headers, `${parsedInteraction.location}.response.headers`, parsedInteraction);
parsedInteraction.responseStatus = {
location: `${parsedInteraction.location}.response.status`,
parentInteraction: parsedInteraction,
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": "@pactflow/swagger-mock-validator",
"version": "11.0.0",
"version": "11.1.0",
"description": "A CLI tool to validate mocks against swagger/OpenApi specs.",
"bin": {
"swagger-mock-validator": "./bin/swagger-mock-validator"
Expand Down

0 comments on commit e40b9ac

Please sign in to comment.