Fixes #1020, OAS3 false positive for extra form param (#1124)

When using an OAS3 spec with formdata, the validation logic looks
for the key 'formData' in the spec parameters list. This keys is
specific to OAS2, and will never be present, causing any form data to
throw an ExtraParameterProblem.
This commit is contained in:
Daniel Grossmann-Kavanagh
2020-01-21 00:49:46 -08:00
committed by Henning Jacobs
parent 1abab0653f
commit ab430afaf5
2 changed files with 15 additions and 1 deletions

View File

@@ -117,6 +117,16 @@ def test_strict_extra_query_param(strict_app):
assert response['detail'] == "Extra query parameter(s) extra_parameter not in spec"
def test_strict_formdata_param(strict_app):
app_client = strict_app.app.test_client()
headers = {'Content-type': 'application/x-www-form-urlencoded'}
url = '/v1.0/test_array_csv_form_param'
resp = app_client.post(url, headers=headers, data={"items":"mango"})
response = json.loads(resp.data.decode('utf-8', 'replace'))
assert response == ['mango']
assert resp.status_code == 200
def test_path_parameter_someint(simple_app):
app_client = simple_app.app.test_client()
resp = app_client.get('/v1.0/test-int-path/123') # type: flask.Response