Skip to content

Commit 624aeb2

Browse files
committed
Add a test for empty HttpResponse body
Related: #210
1 parent 3b78bda commit 624aeb2

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"scriptFile": "main.py",
3+
"disabled": false,
4+
"bindings": [
5+
{
6+
"type": "httpTrigger",
7+
"direction": "in",
8+
"name": "req"
9+
},
10+
{
11+
"type": "http",
12+
"direction": "out",
13+
"name": "$return"
14+
}
15+
]
16+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import azure.functions as azf
2+
3+
4+
def main(req: azf.HttpRequest):
5+
return azf.HttpResponse()

tests/test_http_functions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ def test_return_http_200(self):
3232
self.assertEqual(r.text, '<h1>Hello World™</h1>')
3333
self.assertEqual(r.headers['content-type'], 'text/html; charset=utf-8')
3434

35+
def test_return_http_no_body(self):
36+
r = self.webhost.request('GET', 'return_http_no_body')
37+
self.assertEqual(r.text, '')
38+
self.assertEqual(r.status_code, 200)
39+
3540
def test_return_http_auth_level_admin(self):
3641
r = self.webhost.request('GET', 'return_http_auth_admin',
3742
params={'code': 'testMasterKey'})

0 commit comments

Comments
 (0)