Skip to content

Commit 9a7d090

Browse files
committed
Allow user to specify route key
curl -H 'x-route-key: POST /path/{proxy+}' ...
1 parent bf4d9d9 commit 9a7d090

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lambda_gateway/request_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ def get_event_v2(self, httpMethod):
6363
"""
6464
url = parse.urlparse(self.path)
6565
path, *_ = url.path.split('?')
66+
route_key = self.headers.get('x-route-key') or f'{httpMethod} {path}'
6667
return {
6768
'version': '2.0',
6869
'body': self.get_body(),
69-
'routeKey': f'{httpMethod} {path}',
70+
'routeKey': route_key,
7071
'rawPath': path,
7172
'rawQueryString': url.query,
7273
'headers': dict(self.headers),

0 commit comments

Comments
 (0)