Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Example with path parameters doesn't work #8

Description

@spawn-guy

as the example has delimiter=/ the provided code doesn't work.

here is my solution

var fullPath = request.url.replace(request.scheme+'://'+request.host, '');

var opts = {service: 's3', host: request.host, path: fullPath, region:'eu-west-1'};
var awsObj = aws4.sign(opts, {accessKeyId: variables.get("AWS_ACCESS_KEY_ID"), secretAccessKey: variables.get("AWS_SECRET_ACCESS_KEY")});

request.path = awsObj.path;

for (var header in awsObj.headers) {
    request.headers[header] = awsObj.headers[header];
}

replace scheme and host. the rest of the URL will be path+params

also, region is detected poorly with this implementation. i had to set it explicitly as i was getting error that s3-eu-west-1 is not a valid region

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions