Skip to content

Commit d05ff35

Browse files
authored
Fix: Sanitize text response (GoogleCloudPlatform#8283)
* Fix: Sanitize text response * Added license to template
1 parent 718d6b2 commit d05ff35

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

appengine/flexible/tasks/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"""App Engine app to serve as an endpoint for App Engine queue samples."""
1616

1717
# [START cloud_tasks_appengine_quickstart]
18-
from flask import Flask, request
18+
from flask import Flask, render_template, request
1919

2020
app = Flask(__name__)
2121

@@ -25,7 +25,7 @@ def example_task_handler():
2525
"""Log the request payload."""
2626
payload = request.get_data(as_text=True) or '(empty payload)'
2727
print('Received task with payload: {}'.format(payload))
28-
return 'Printed task payload: {}'.format(payload)
28+
return render_template("index.html", payload=payload)
2929
# [END cloud_tasks_appengine_quickstart]
3030

3131

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!--
2+
Copyright 2022 Google LLC
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
-->
13+
<!DOCTYPE html>
14+
<html>
15+
<head>
16+
<title>Tasks Sample</title>
17+
</head>
18+
<body>
19+
<p>Printed task payload: {{ payload }}</p>
20+
</body>
21+
</html>

0 commit comments

Comments
 (0)