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

Make parameter names consistent with Node samples #1648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 4 functions/helloworld/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def hello_http(request):
<http://flask.pocoo.org/docs/0.12/api/#flask.Flask.make_response>.
"""
request_json = request.get_json()
if request_json and 'message' in request_json:
name = request_json['message']
if request_json and 'name' in request_json:
name = request_json['name']
else:
name = 'World'
return 'Hello, {}!'.format(name)
Expand Down
2 changes: 1 addition & 1 deletion 2 functions/helloworld/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_hello_http_no_args(app):


def test_hello_http_args(app):
with app.test_request_context(json={'message': 'test'}):
with app.test_request_context(json={'name': 'test'}):
res = main.hello_http(flask.request)
assert 'Hello, test!' in res

Expand Down
2 changes: 1 addition & 1 deletion 2 functions/helloworld/sample_http_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

def test_print_name():
name = 'test'
req = Mock(get_json=Mock(return_value={'message': name}))
req = Mock(get_json=Mock(return_value={'name': name}))

# Call tested function
assert main.hello_http(req) == 'Hello, {}!'.format(name)
Expand Down
2 changes: 1 addition & 1 deletion 2 functions/helloworld/sample_http_test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_args():
name = str(uuid.uuid4())
res = requests.post(
'{}/hello_http'.format(BASE_URL),
json={'message': name}
json={'name': name}
)
assert res.text == 'Hello, {}!'.format(name)
# [END functions_http_system_test]
Morty Proxy This is a proxified and sanitized view of the page, visit original site.