mirror of
https://github.com/LukeHagar/connexion.git
synced 2025-12-09 20:37:46 +00:00
Fixes #1869 . Changes proposed in this pull request: - Prioritise parsing JSON over splitting array --------- Co-authored-by: Alex Fechner <alex.fechner@stryker.com>
This commit is contained in:
@@ -128,3 +128,27 @@ def test_multipart_form_json(json_validation_spec_dir, spec, app_class):
|
||||
assert res.status_code == 200
|
||||
assert res.json()["name"] == "joe-reply"
|
||||
assert res.json()["age"] == 30
|
||||
|
||||
|
||||
@pytest.mark.parametrize("spec", ["openapi.yaml"])
|
||||
def test_multipart_form_json_array(json_validation_spec_dir, spec, app_class):
|
||||
app = build_app_from_fixture(
|
||||
json_validation_spec_dir,
|
||||
app_class=app_class,
|
||||
spec_file=spec,
|
||||
validate_responses=True,
|
||||
)
|
||||
app_client = app.test_client()
|
||||
|
||||
res = app_client.post(
|
||||
"/v1.0/multipart_form_json_array",
|
||||
files={"file": b""}, # Force multipart/form-data content-type
|
||||
data={
|
||||
"x": json.dumps([{"name": "joe", "age": 20}, {"name": "alena", "age": 28}])
|
||||
},
|
||||
)
|
||||
assert res.status_code == 200
|
||||
assert res.json()[0]["name"] == "joe-reply"
|
||||
assert res.json()[0]["age"] == 30
|
||||
assert res.json()[1]["name"] == "alena-reply"
|
||||
assert res.json()[1]["age"] == 38
|
||||
|
||||
Reference in New Issue
Block a user