Skip to content

Support 'allowReserved' property when validating form-data body #497

Closed
@chris-miaskowski

Description

User story.
As a Prism user, I can OAS3 body parameter encoding to allow reserved characters, so that I can handle more real life corner cases.

Additional context

Note that this test should already exist in the source code. At the time of writing this issue up it exited on a feature branch under test-harness/specs/validate-body-params/form-data-allow-reserved-fail.oas3.txt.unsupported

====test====
Send reserved characters in body and expect to fail validation.
====spec====
openapi: '3.0.1'
paths:
/path:
post:
responses:
200:
content:
text/plain:
example: ok
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
reserved:
type: string
encoding:
reserved:
contentType: text/plain
allowReserved: false
style: form
====server====
mock -p 4010
====command====
curl -i -X POST http://localhost:4010/path -H "Content-Type: application/x-www-form-urlencoded" --data "reserved=:/?#[]@!$&'()*+,;"
====expect====
HTTP/1.1 422 Unprocessable Entity
content-type: application/problem+json
Connection: keep-alive

{ "to-be": "done" }

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions