Skip to content

Commit a5bf44d

Browse files
authored
docs: add Default Content-Type values section (#1284)
1 parent 98c9a1c commit a5bf44d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/MIGRATION_2_X.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,17 @@ https://github.com/swagger-api/swagger-ui/issues/2793
136136

137137
> NOTE: Cookie authentication is not implemented.
138138
139+
#### Default Content-Type values
140+
141+
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`:
142+
143+
```js
144+
Swagger({
145+
url: "http://petstore.swagger.io/v2/swagger.json",
146+
requestInterceptor: req => {
147+
if(req.body && !req.headers["Content-Type"]) {
148+
req.headers["Content-Type"] = "application/json"
149+
}
150+
}
151+
})
152+
```

0 commit comments

Comments
 (0)