Skip to content

Commit

Permalink
Add wireframes for HTTP methods
Browse files Browse the repository at this point in the history
+ DELETE
+ OPTIONS
+ PATCH
+ PUT
  • Loading branch information
amancevice committed May 10, 2021
1 parent bbd02e9 commit a276610
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lambda_gateway/request_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,27 @@


class LambdaRequestHandler(SimpleHTTPRequestHandler):
def do_DELETE(self):
self.invoke('DELETE')

def do_GET(self):
self.invoke('GET')

def do_HEAD(self):
self.invoke('HEAD')

def do_OPTIONS(self):
self.invoke('OPTIONS')

def do_PATCH(self):
self.invoke('PATCH')

def do_POST(self):
self.invoke('POST')

def do_PUT(self):
self.invoke('PUT')

def get_body(self):
"""
Get request body to forward to Lambda handler.
Expand Down
3 changes: 2 additions & 1 deletion tests/test_request_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def test_set_proxy(self, proxy, version):
assert LambdaRequestHandler.proxy == proxy
assert LambdaRequestHandler.version == version

@pytest.mark.parametrize('verb', ['GET', 'HEAD', 'POST'])
@pytest.mark.parametrize('verb', [
'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT'])
def test_do(self, verb):
getattr(LambdaRequestHandler, f'do_{verb}')(self.subject)
self.subject.invoke.assert_called_once_with(verb)
Expand Down

0 comments on commit a276610

Please sign in to comment.