Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safely handle - in auth headers #72

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/apideck-libraries/postman-to-k6/compare/v1.8.3...HEAD)

### Fixed

- Auth headers with `-` in the key name are handled properly (#62)
- Bump dependencies like husky, urijs, papaparse, chai, aws4, shell-quote, trim-off-newlines, minimist (#70)

## [1.8.3] - 2020-11-22

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions lib/auth/apikey.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ class ApiKeyAuth {
const value = aid.evalString(params.get('value'));

if (params.get('in') === 'header') {
this.logic = '' + `config.headers.${key} = ${value};`;
this.logic = '' + `config.headers['${key}'] = ${value};`;
} else {
this.logic = '' + `config.options.${key} = ${value};`;
this.logic = '' + `config.options['${key}'] = ${value};`;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/int/snapshots/auth.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Generated by [AVA](https://ava.li).
method: "GET",␊
address: "http://example.com/",␊
auth(config, Var) {␊
config.headers.Authorization = "secretApiKey";␊
config.headers["Authorization"] = "secretApiKey";␊
}␊
});␊
}␊
Expand Down
Binary file modified test/int/snapshots/auth.js.snap
Binary file not shown.
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1818,9 +1818,9 @@ camelcase@^5.3.1:
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==

caniuse-lite@^1.0.30001248:
version "1.0.30001251"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz#6853a606ec50893115db660f82c094d18f096d85"
integrity sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A==
version "1.0.30001374"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001374.tgz"
integrity sha512-mWvzatRx3w+j5wx/mpFN5v5twlPrabG8NqX2c6e45LCpymdoGqNvRkRutFUqpRTXKFQFNQJasvK0YT7suW6/Hw==

chai@^4.3.4:
version "4.3.6"
Expand Down