2022-02-14 11:13:33 +03:00
|
|
|
from app import app
|
2022-11-21 17:08:03 +03:00
|
|
|
from flask import request
|
2021-07-01 21:02:47 +03:00
|
|
|
|
2022-02-05 08:56:33 +03:00
|
|
|
|
2022-11-21 17:08:03 +03:00
|
|
|
@app.route("/multilines/plain-text", methods=["POST"])
|
2022-11-15 14:00:29 +03:00
|
|
|
def multilines_plain_text():
|
2022-11-21 17:08:03 +03:00
|
|
|
expected_body = "line1\nline2\nline3\n"
|
|
|
|
body_in = request.data.decode("utf-8")
|
|
|
|
assert expected_body == body_in
|
|
|
|
return expected_body
|
2022-11-15 14:00:29 +03:00
|
|
|
|
|
|
|
|
2022-11-21 17:08:03 +03:00
|
|
|
@app.route("/multilines/json", methods=["POST"])
|
2022-11-15 14:00:29 +03:00
|
|
|
def multilines_json():
|
2022-11-21 17:08:03 +03:00
|
|
|
expected_body = """\
|
2022-11-15 14:00:29 +03:00
|
|
|
{
|
|
|
|
"foo": "bar"
|
|
|
|
"baz": 123456
|
|
|
|
}
|
|
|
|
"""
|
2022-11-21 17:08:03 +03:00
|
|
|
body_in = request.data.decode("utf-8")
|
|
|
|
assert expected_body == body_in
|
|
|
|
return expected_body
|
2022-11-15 14:00:29 +03:00
|
|
|
|
|
|
|
|
2022-11-21 17:08:03 +03:00
|
|
|
@app.route("/multilines/xml", methods=["POST"])
|
2022-11-15 14:00:29 +03:00
|
|
|
def multilines_xml():
|
2022-11-21 17:08:03 +03:00
|
|
|
expected_body = """\
|
2022-11-15 14:00:29 +03:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<catalog>
|
2022-11-21 17:08:03 +03:00
|
|
|
<book id="bk101">
|
|
|
|
<author>Gambardella, Matthew</author>
|
|
|
|
<title>XML Developer's Guide</title>
|
|
|
|
<genre>Computer</genre>
|
|
|
|
<price>44.95</price>
|
|
|
|
<publish_date>2000-10-01</publish_date>
|
|
|
|
<description>An in-depth look at creating applications
|
|
|
|
with XML.</description>
|
|
|
|
</book>
|
2022-11-15 14:00:29 +03:00
|
|
|
</catalog>
|
|
|
|
"""
|
2022-11-21 17:08:03 +03:00
|
|
|
body_in = request.data.decode("utf-8")
|
|
|
|
assert expected_body == body_in
|
|
|
|
return expected_body
|
2022-11-15 14:00:29 +03:00
|
|
|
|
|
|
|
|
2022-11-21 17:08:03 +03:00
|
|
|
@app.route("/multilines/graphql", methods=["POST"])
|
2022-11-15 14:00:29 +03:00
|
|
|
def multilines_graphql():
|
2022-11-24 18:14:44 +03:00
|
|
|
expected_body = r'{"query":"{\n hero {\n name\n # Queries can have comments!\n friends {\n name\n }\n }\n}"}'
|
2022-11-21 17:08:03 +03:00
|
|
|
body_in = request.data.decode("utf-8")
|
|
|
|
assert expected_body == body_in
|
|
|
|
return expected_body
|