SignatureV4.sign() signs an HTTP request with the AWS Signature V4 algorithm. Given an HTTP request description, it returns a new HTTP request with the AWS signature v4 protocol headers added. It returns an Object holding a url and a headers properties, ready to use in the context of k6's HTTP call.
The first parameter of the sign method consists of an Object with the following properties.
|method||string||The HTTP method of the request|
|protocol||http or https string||The network protocol of the request|
|hostname||string||The hostname the request is sent to|
|path||string||The path of the request|
|headers||Object||The headers of the HTTP request|
|uriEscapePath||boolean||Whether to uri-escape the request URI path as part of computing the canonical request string. This is required for every AWS service, except Amazon S3, as of late 2017.|
|applyChecksum||boolean||Whether to calculate a checksum of the request body and include it as either a request header (when signing) or as a query string parameter (when pre-signing). This is required for AWS Glacier and Amazon S3 and optional for every other AWS service as of late 2017.|
You can override SignatureV4 options in the context of this specific request. To do this, pass a second parameter to the sign method, which is an Object with the following parameters.
|signingDate||Date||overrides the Date used in the signing operation|
|signingService||string||overrides the signer's AWS service in the context of the sign operation.|
|signingRegion||string||overrides the signer's AWS region in the context of the sign operation|
|unsignableHeaders||Set<string>||excludes headers from the signing process|
|signableHeaders||Set<string>||mark headers as signed|
|headers||Object||The signed request's headers to use in the context of a k6 HTTP request|
|url||string||The signed url to use in the context of a k6 HTTP request|