forked from orbit-oss/flask
Support returning list as JSON
This commit is contained in:
parent
1626aff602
commit
ca2bfbb0ac
3 changed files with 16 additions and 4 deletions
|
|
@ -1166,6 +1166,10 @@ def test_response_types(app, client):
|
|||
def from_dict():
|
||||
return {"foo": "bar"}, 201
|
||||
|
||||
@app.route("/list")
|
||||
def from_list():
|
||||
return ["foo", "bar"], 201
|
||||
|
||||
assert client.get("/text").data == "Hällo Wörld".encode()
|
||||
assert client.get("/bytes").data == "Hällo Wörld".encode()
|
||||
|
||||
|
|
@ -1205,6 +1209,10 @@ def test_response_types(app, client):
|
|||
assert rv.json == {"foo": "bar"}
|
||||
assert rv.status_code == 201
|
||||
|
||||
rv = client.get("/list")
|
||||
assert rv.json == ["foo", "bar"]
|
||||
assert rv.status_code == 201
|
||||
|
||||
|
||||
def test_response_type_errors():
|
||||
app = flask.Flask(__name__)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue