-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix apigw http proxy response passthrough (#10583)
- Loading branch information
1 parent
a38de24
commit 85486d2
Showing
7 changed files
with
148 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
9 changes: 6 additions & 3 deletions
9
tests/aws/services/apigateway/test_apigateway_http.validation.json
This file contains 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
19 changes: 19 additions & 0 deletions
19
tests/aws/services/lambda_/functions/lambda_echo_status_code.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import json | ||
from http import HTTPStatus | ||
|
||
|
||
def make_response(status_code: int, message: str): | ||
return { | ||
"statusCode": status_code, | ||
"headers": {"Content-Type": "application/json"}, | ||
"body": {"status_code": status_code, "message": message}, | ||
} | ||
|
||
|
||
def handler(event, context): | ||
print(json.dumps(event)) | ||
path: str = event["requestContext"]["http"].get("path", "") | ||
status_code = path.split("/")[-1] | ||
if not status_code.isdigit() or int(status_code) not in list(HTTPStatus): | ||
return make_response(HTTPStatus.BAD_REQUEST, f"No valid status found at end of path {path}") | ||
return make_response(int(status_code), "") |
This file contains 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