Skip to content

Commit 78e0a1b

Browse files
authored
refactor: update http sample (GoogleCloudPlatform#7193)
## Description Update http sample to use declarative function signature. ## Checklist - [x] I have followed [Sample Guidelines from AUTHORING_GUIDE.MD](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md) - [x] README is updated to include [all relevant information](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#readme-file) - [x] **Tests** pass: `nox -s py-3.6` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#test-environment-setup)) - [x] **Lint** pass: `nox -s lint` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] These samples need a new **API enabled** in testing projects to pass (let us know which ones) - [ ] These samples need a new/updated **env vars** in testing projects set to pass (let us know which ones) - [x] Please **merge** this PR for me once it is approved. - [ ] This sample adds a new sample directory, and I updated the [CODEOWNERS file](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/.github/CODEOWNERS) with the codeowners for this sample
1 parent b026b56 commit 78e0a1b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

functions/helloworld/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# [START functions_helloworld_http]
1818
# [START functions_http_content]
1919
from flask import escape
20+
import functions_framework
2021

2122
# [END functions_helloworld_http]
2223
# [END functions_http_content]
@@ -157,6 +158,7 @@ def hello_content(request):
157158

158159

159160
# [START functions_http_method]
161+
@functions_framework.http
160162
def hello_method(request):
161163
""" Responds to a GET request with "Hello world!". Forbids a PUT request.
162164
Args:

0 commit comments

Comments
 (0)