Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6fd6f6b

Browse filesBrowse files
author
Ace Nassri
authored
Change parameter name (GoogleCloudPlatform#1648)
Change-Id: I2944471fab3f318a3e691031ef75419f5b3061f6
1 parent 36c4c80 commit 6fd6f6b
Copy full SHA for 6fd6f6b

File tree

Expand file treeCollapse file tree

4 files changed

+5
-5
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+5
-5
lines changed

‎functions/helloworld/main.py

Copy file name to clipboardExpand all lines: functions/helloworld/main.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def hello_http(request):
5858
<http://flask.pocoo.org/docs/0.12/api/#flask.Flask.make_response>.
5959
"""
6060
request_json = request.get_json()
61-
if request_json and 'message' in request_json:
62-
name = request_json['message']
61+
if request_json and 'name' in request_json:
62+
name = request_json['name']
6363
else:
6464
name = 'World'
6565
return 'Hello, {}!'.format(name)

‎functions/helloworld/main_test.py

Copy file name to clipboardExpand all lines: functions/helloworld/main_test.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_hello_http_no_args(app):
3737

3838

3939
def test_hello_http_args(app):
40-
with app.test_request_context(json={'message': 'test'}):
40+
with app.test_request_context(json={'name': 'test'}):
4141
res = main.hello_http(flask.request)
4242
assert 'Hello, test!' in res
4343

‎functions/helloworld/sample_http_test.py

Copy file name to clipboardExpand all lines: functions/helloworld/sample_http_test.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
def test_print_name():
2222
name = 'test'
23-
req = Mock(get_json=Mock(return_value={'message': name}))
23+
req = Mock(get_json=Mock(return_value={'name': name}))
2424

2525
# Call tested function
2626
assert main.hello_http(req) == 'Hello, {}!'.format(name)

‎functions/helloworld/sample_http_test_system.py

Copy file name to clipboardExpand all lines: functions/helloworld/sample_http_test_system.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_args():
3434
name = str(uuid.uuid4())
3535
res = requests.post(
3636
'{}/hello_http'.format(BASE_URL),
37-
json={'message': name}
37+
json={'name': name}
3838
)
3939
assert res.text == 'Hello, {}!'.format(name)
4040
# [END functions_http_system_test]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.