Skip to content

Commit 46b8b2b

Browse files
committed
chore: expand multipart example
1 parent ceb28f8 commit 46b8b2b

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

reference/paths/operations/content.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@ content:
221221
description: A photo of the drink.
222222
type: string
223223
format: binary
224+
recipe:
225+
description: The recipe for the drink.
226+
type: string
227+
name:
228+
description: The name of the drink.
229+
type: string
224230
encoding:
225231
photo:
226232
contentType: image/jpeg, image/png
@@ -231,16 +237,35 @@ content:
231237
type: string
232238
default: 'form-data; name="photo"; filename="default.jpg"'
233239
allowReserved: false
240+
recipe:
241+
contentType: text/plain
242+
headers:
243+
Content-Disposition:
244+
description: Specifies the disposition of the file (attachment and file name).
245+
schema:
246+
type: string
247+
default: 'form-data; name="recipe"; filename="default.txt"'
248+
allowReserved: false
249+
name:
250+
contentType: text/plain
251+
headers:
252+
Content-Disposition:
253+
description: Specifies the disposition of the field.
254+
schema:
255+
type: string
256+
default: 'form-data; name="name"'
257+
allowReserved: false
234258
```
235259

236-
In this example, the server expects a form data request with a photo of the drink. The `encoding` field provides additional information about the photo, such as the content type, headers, and whether reserved characters are allowed.
260+
In this example, the server expects a form data request with a photo of the drink, the recipe for the drink, and the name of the drink. The `encoding` field provides additional information about each part, such as the content type, headers, and whether reserved characters are allowed.
237261

238-
The curl command below sends a request to the server with a photo file in the body:
262+
The curl command below sends a request to the server with a photo file, a recipe file, and the name of the drink in the body:
239263

240264
```bash
241265
curl -X POST "https://api.example.com/drinks" \
242-
-H "Content-Type: multipart/form-data" \
243-
-F "[email protected];type=image/jpeg"
266+
-F "[email protected];type=image/jpeg" \
267+
-F "[email protected];type=text/plain" \
268+
-F "name=Mocktail"
244269
```
245270

246271
## OpenAPI Content Best Practices

0 commit comments

Comments
 (0)