Skip to content

Commit 171b726

Browse files
authored
Merge pull request spring-media#26 from capcito/master
ProxyResources. Adding new config: proxyPath
2 parents 072aa59 + cdd52b7 commit 171b726

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface ProxyIntegrationConfig {
1515
debug?: boolean;
1616
errorMapping?: any;
1717
defaultHeaders?: string;
18+
proxyPath?: string;
1819
}
1920

2021
export interface SnsRoute {

lib/proxyIntegration.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ function process(proxyIntegrationConfig, event, context) {
8080
const errorMapping = proxyIntegrationConfig.errorMapping || {};
8181
errorMapping['NO_MATCHING_ACTION'] = 404;
8282

83-
event.path = normalizeRequestPath(event);
83+
if (proxyIntegrationConfig.proxyPath) {
84+
event.path = event.pathParameters[proxyIntegrationConfig.proxyPath];
85+
} else {
86+
event.path = normalizeRequestPath(event);
87+
}
8488

8589
try {
8690
const actionConfig = findMatchingActionConfig(event.httpMethod, event.path, proxyIntegrationConfig) || {

0 commit comments

Comments
 (0)