Closed bloodtick closed 5 years ago
This looks like a good solution for those who need custom headers since I won't be able to finish the key/value input. Would you consider instead requiring the full JSON object to include {}
? Writing JSON in webCoRE is a bit of a pain since you have to escape the braces like\{
, but it gives you an unambiguous startsWith()
test. Authorization headers may not always be base 64 encoded so I wouldn't want to break requests if anyone happened to have a colon character there.
P.S. Sorry, this comment was originally left on the commit rather than the pull request.
If authorization headers are not base64 the colon check would pose a problem as you identified. Your proposal seems appropriate. My production implementation if fluid, so let me make your suggested modification and repost the pull request (unless you just want to roll with it).
Updated and verified to work with { and }.
Thanks! This is merged to the dev branch to be included in the next release. There are a few other fixes staged so after some testing this will probably go live next week.
User can use a JSON map defined to insert additional headers. Hack is backwards compatible as it looks for a colon : that should not be used in base64 encoding required for the 'authorization' header. Example: "x-api-key" : "{apikey}", "authorization" : "{apikey}", "Public-Key-Pins": "max-age=2592000; pin-sha256=\"E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=\";"