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

Example with path parameters doesn't work #8

Open
spawn-guy opened this issue Oct 13, 2020 · 0 comments
Open

Example with path parameters doesn't work #8

spawn-guy opened this issue Oct 13, 2020 · 0 comments

Comments

@spawn-guy
Copy link

spawn-guy commented Oct 13, 2020

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant