Skip to content

Commit 0f6d762

Browse files
committed
Add docs
1 parent fa32db3 commit 0f6d762

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
@@ -143,6 +143,18 @@ const { data, error } = await client.PUT("/submit", {
143143
});
144144
```
145145

146+
::: tip
147+
148+
For convenience, `openapi-fetch` sets `Content-Type` to `application/json` automatically
149+
for any request that provides value for the `body` parameter. When the `bodySerializer` returns an instance of `FormData`,
150+
`Content-Type` is omitted, allowing the browser to set it automatically with the correct message part boundary.
151+
152+
You can also set `Content-Type` manually through `headers` object either in the fetch options,
153+
or when instantiating the client. Setting `Content-Type` to `null` will omit the header, however the native fetch API
154+
will likely set it to `text/plain` in this case.
155+
156+
:::
157+
146158
## Path serialization
147159

148160
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)