Last active
January 18, 2019 10:48
-
-
Save gyfis/eb4f8bde54d9ad43ec865be1359bfb87 to your computer and use it in GitHub Desktop.
Path parameters inconsistency - SAM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hello_world/api.js | |
exports.lambdaHandler = async (event, context) => { | |
return { | |
'statusCode': 200, | |
'body': JSON.stringify(event) | |
} | |
}; | |
// 127.0.0.1:3000/test/users/3/file/Desktop%2Fphotos%2Fcat.png | |
// output -> local_response.json | |
// <AWS-API-GATEWAY-URL>/test/users/3/file/Desktop%2Fphotos%2Fcat.png | |
// output -> aws_response.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"resource": "/{path+}", | |
"path": "/test/users/3/file/Desktop%2Fphotos%2Fcat.png", | |
"httpMethod": "GET", | |
"headers": { | |
"values": "<FILTERED>" | |
}, | |
"queryStringParameters": null, | |
"pathParameters": { | |
"path": "test/users/3/file/Desktop%2Fphotos%2Fcat.png" | |
}, | |
"stageVariables": null, | |
"requestContext": { | |
"value": "<FILTERED>" | |
}, | |
"body": null, | |
"isBase64Encoded": false | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"resource": "/{path+}", | |
"path": "/test/users/3/file/Desktop/photos/cat.png", | |
"httpMethod": "GET", | |
"headers": { | |
"values": "<FILTERED>" | |
}, | |
"queryStringParameters": null, | |
"pathParameters": { | |
"path": "test/users/3/file/Desktop/photos/cat.png" | |
}, | |
"stageVariables": null, | |
"requestContext": { | |
"value": "<FILTERED>" | |
}, | |
"body": null, | |
"isBase64Encoded": false | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: AWS::Serverless-2016-10-31 | |
Description: Path parameters example | |
Resources: | |
HelloWorldFunction: | |
Type: AWS::Serverless::Function | |
Properties: | |
CodeUri: hello_world/ | |
Handler: app.lambdaHandler | |
Runtime: nodejs8.10 | |
Events: | |
HelloWorld: | |
Type: Api | |
Properties: | |
Path: /{path+} | |
Method: get |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment