Skip to content

Commit

Permalink
Fix: Sanitize text response (GoogleCloudPlatform#8283)
Browse files Browse the repository at this point in the history
* Fix: Sanitize text response

* Added license to template
  • Loading branch information
engelke authored Aug 23, 2022
1 parent 718d6b2 commit d05ff35
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions appengine/flexible/tasks/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""App Engine app to serve as an endpoint for App Engine queue samples."""

# [START cloud_tasks_appengine_quickstart]
from flask import Flask, request
from flask import Flask, render_template, request

app = Flask(__name__)

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


Expand Down
21 changes: 21 additions & 0 deletions appengine/flexible/tasks/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
Copyright 2022 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html>
<html>
<head>
<title>Tasks Sample</title>
</head>
<body>
<p>Printed task payload: {{ payload }}</p>
</body>
</html>

0 comments on commit d05ff35

Please sign in to comment.