Skip to content

Commit

Permalink
docs: add Default Content-Type values section (#1284)
Browse files Browse the repository at this point in the history
  • Loading branch information
shockey committed Apr 13, 2018
1 parent 98c9a1c commit a5bf44d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/MIGRATION_2_X.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,17 @@ https://github.com/swagger-api/swagger-ui/issues/2793

> NOTE: Cookie authentication is not implemented.
#### Default Content-Type values

Swagger-Client no longer assumes you want `Content-Type: application/json` if you don't provide any `consumes` values. If you want to preserve that behavior, you'll need to implement it yourself with a `requestInterceptor`:

```js
Swagger({
url: "http://petstore.swagger.io/v2/swagger.json",
requestInterceptor: req => {
if(req.body && !req.headers["Content-Type"]) {
req.headers["Content-Type"] = "application/json"
}
}
})
```

0 comments on commit a5bf44d

Please sign in to comment.