Nordstrom / artillery-plugin-aws-sigv4

Plugin for artillery.io that signs HTTP requests using the AWS Signature V4 specification.
Apache License 2.0
16 stars 21 forks source link

Fix for #13 and adds test target and notes. #18

Closed gwsii closed 4 years ago

gwsii commented 4 years ago

Two changes were necessary to fix URL signing.

1 - replace all variables in the URL with those provided in the context

    // Perform variable substitution in url.
    const varNames = Object.getOwnPropertyNames(context.vars)
    const actualUrl = varNames.reduce((accUrl, name) => {
      return accUrl.split(`{{${name}}}`).join(context.vars[name])
    }, url.split(' ').join(''))

2 - include the query string in the request path

request.path = targetUrl.pathname + targetUrl.search