from app import app from flask import request @app.route("/multilines/plain-text", methods=["POST"]) def multilines_plain_text(): expected_body = "line1\nline2\nline3\n" body_in = request.data.decode("utf-8") assert expected_body == body_in return expected_body @app.route("/multilines/json", methods=["POST"]) def multilines_json(): expected_body = """\ { "foo": "bar" "baz": 123456 } """ body_in = request.data.decode("utf-8") assert expected_body == body_in return expected_body @app.route("/multilines/xml", methods=["POST"]) def multilines_xml(): expected_body = """\ Gambardella, Matthew XML Developer's Guide Computer 44.95 2000-10-01 An in-depth look at creating applications with XML. """ body_in = request.data.decode("utf-8") assert expected_body == body_in return expected_body @app.route("/multilines/graphql", methods=["POST"]) def multilines_graphql(): expected_body = r'{"query":"{\n hero {\n name\n # Queries can have comments!\n friends {\n name\n }\n }\n}"}' body_in = request.data.decode("utf-8") assert expected_body == body_in return expected_body