Skip to content

Commit

Permalink
Allow user to specify route key
Browse files Browse the repository at this point in the history
curl -H 'x-route-key: POST /path/{proxy+}' ...
  • Loading branch information
amancevice committed Apr 25, 2021
1 parent bf4d9d9 commit 9a7d090
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lambda_gateway/request_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ def get_event_v2(self, httpMethod):
"""
url = parse.urlparse(self.path)
path, *_ = url.path.split('?')
route_key = self.headers.get('x-route-key') or f'{httpMethod} {path}'
return {
'version': '2.0',
'body': self.get_body(),
'routeKey': f'{httpMethod} {path}',
'routeKey': route_key,
'rawPath': path,
'rawQueryString': url.query,
'headers': dict(self.headers),
Expand Down

0 comments on commit 9a7d090

Please sign in to comment.