You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Re-organize form-urlencoded guidance (3.1.1 port of 3923 4/6)
This re-organizes and streamlines the form-urlencoded guidance
that was consolidated from the Media Type Object.
It also adds an example of a base64-encoded URL query parameter.
Copy file name to clipboardExpand all lines: versions/3.1.1.md
+16-11Lines changed: 16 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1718,13 +1718,15 @@ The absence of all three of those fields is the equivalent of using `content`, b
1718
1718
1719
1719
##### Encoding the `x-www-form-urlencoded` Media Type
1720
1720
1721
-
See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination of percent-encoding concerns for form media types.
1721
+
To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), use the `application/x-www-form-urlencoded` media type in the [Media Type Object](#mediaTypeObject) under the [Request Body Object](#requestBodyObject).
1722
+
This configuration means that the request body MUST be encoded per [RFC1866](https://tools.ietf.org/html/rfc1866) when passed to the server, after any complex objects have been serialized to a string representation.
1722
1723
1723
-
To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), the following
1724
-
definition may be used:
1724
+
See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination of percent-encoding concerns for form media types.
1725
1725
1726
1726
###### Example: URL Encoded Form with JSON Values
1727
1727
1728
+
When there is no [`encoding` field](#mediaTypeEncoding), the serialization strategy is based on the Encoding Object's default values:
1729
+
1728
1730
```yaml
1729
1731
requestBody:
1730
1732
content:
@@ -1741,11 +1743,7 @@ requestBody:
1741
1743
properties: {}
1742
1744
```
1743
1745
1744
-
In this example, the contents in the `requestBody` MUST be encoded per [RFC1866](https://tools.ietf.org/html/rfc1866) when passed to the server. In addition, the `address` field complex object will be serialized to a string representation prior to encoding.
1745
-
1746
-
When passing complex objects in the `application/x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the [Encoding Object](#encodingObject)'s [`style`](#encodingStyle) property as `form`.
1747
-
1748
-
With this example, given an `id` of `f81d4fae-7dec-11d0-a765-00a0c91e6bf6` and a US-style address (with ZIP+4) as follows:
1746
+
With this example, consider an `id` of `f81d4fae-7dec-11d0-a765-00a0c91e6bf6` and a US-style address (with ZIP+4) as follows:
It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is REQUIRED to define the input parameters to the operation when using `multipart` content. This supports complex structures as well as supporting mechanisms for multiple file uploads.
0 commit comments