Skip to content

Commit a276610

Browse files
committed
Add wireframes for HTTP methods
+ DELETE + OPTIONS + PATCH + PUT
1 parent bbd02e9 commit a276610

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lambda_gateway/request_handler.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,27 @@
33

44

55
class LambdaRequestHandler(SimpleHTTPRequestHandler):
6+
def do_DELETE(self):
7+
self.invoke('DELETE')
8+
69
def do_GET(self):
710
self.invoke('GET')
811

912
def do_HEAD(self):
1013
self.invoke('HEAD')
1114

15+
def do_OPTIONS(self):
16+
self.invoke('OPTIONS')
17+
18+
def do_PATCH(self):
19+
self.invoke('PATCH')
20+
1221
def do_POST(self):
1322
self.invoke('POST')
1423

24+
def do_PUT(self):
25+
self.invoke('PUT')
26+
1527
def get_body(self):
1628
"""
1729
Get request body to forward to Lambda handler.

tests/test_request_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ def test_set_proxy(self, proxy, version):
7474
assert LambdaRequestHandler.proxy == proxy
7575
assert LambdaRequestHandler.version == version
7676

77-
@pytest.mark.parametrize('verb', ['GET', 'HEAD', 'POST'])
77+
@pytest.mark.parametrize('verb', [
78+
'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT'])
7879
def test_do(self, verb):
7980
getattr(LambdaRequestHandler, f'do_{verb}')(self.subject)
8081
self.subject.invoke.assert_called_once_with(verb)

0 commit comments

Comments
 (0)