2022-02-14 11:13:33 +03:00
|
|
|
from app import app
|
2020-08-27 10:07:46 +03:00
|
|
|
from flask import request
|
|
|
|
|
|
|
|
|
2022-02-05 08:56:33 +03:00
|
|
|
@app.route("/output/endpoint1", methods=["POST"])
|
2020-08-27 10:07:46 +03:00
|
|
|
def output_endpoint1():
|
2022-02-05 08:56:33 +03:00
|
|
|
assert request.headers["Content-Type"] == "application/json"
|
2020-08-27 10:07:46 +03:00
|
|
|
s = request.data.decode("utf-8")
|
|
|
|
assert s == '{ "user": "bob" }'
|
|
|
|
return app.response_class(
|
2022-02-05 08:56:33 +03:00
|
|
|
headers={"date": "DATE1"}, response="Response endpoint1\n"
|
2020-08-27 10:07:46 +03:00
|
|
|
)
|
|
|
|
|
2022-02-05 08:56:33 +03:00
|
|
|
|
2020-08-27 10:07:46 +03:00
|
|
|
@app.route("/output/endpoint2")
|
|
|
|
def output_endpoint2():
|
|
|
|
return app.response_class(
|
2022-02-05 08:56:33 +03:00
|
|
|
headers={"date": "DATE2"}, response="Response endpoint2\n"
|
2020-08-27 10:07:46 +03:00
|
|
|
)
|