Skip to content

Commit 880b288

Browse files
committed
Add docs
1 parent 80e2b93 commit 880b288

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/openapi-fetch/api.md

+12
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,18 @@ const { data, error } = await client.PUT("/submit", {
181181
});
182182
```
183183

184+
::: tip
185+
186+
For convenience, `openapi-fetch` sets `Content-Type` to `application/json` automatically
187+
for any request that provides value for the `body` parameter. When the `bodySerializer` returns an instance of `FormData`,
188+
`Content-Type` is omitted, allowing the browser to set it automatically with the correct message part boundary.
189+
190+
You can also set `Content-Type` manually through `headers` object either in the fetch options,
191+
or when instantiating the client. Setting `Content-Type` to `null` will omit the header, however the native fetch API
192+
will likely set it to `text/plain` in this case.
193+
194+
:::
195+
184196
## Path serialization
185197

186198
openapi-fetch supports path serialization as [outlined in the 3.1 spec](https://swagger.io/docs/specification/serialization/#path). This happens automatically, based on the specific format in your OpenAPI schema:

0 commit comments

Comments
 (0)