Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
goce-cz committed Aug 7, 2024
1 parent fa32db3 commit 0f6d762
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/openapi-fetch/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ const { data, error } = await client.PUT("/submit", {
});
```

::: tip

For convenience, `openapi-fetch` sets `Content-Type` to `application/json` automatically
for any request that provides value for the `body` parameter. When the `bodySerializer` returns an instance of `FormData`,
`Content-Type` is omitted, allowing the browser to set it automatically with the correct message part boundary.

You can also set `Content-Type` manually through `headers` object either in the fetch options,
or when instantiating the client. Setting `Content-Type` to `null` will omit the header, however the native fetch API
will likely set it to `text/plain` in this case.

:::

## Path serialization

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:
Expand Down

0 comments on commit 0f6d762

Please sign in to comment.