Skip to content

Commit 41f9c95

Browse files
committed
accept: application/problem+json responses
1 parent d6ae181 commit 41f9c95

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/client.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function request(url, options) {
5252
credentials: "include",
5353
headers: {
5454
...(options.headers || {}),
55-
"accept": "application/vnd.api+json",
55+
"accept": "application/vnd.api+json, application/problem+json",
5656
},
5757
};
5858
return fetch(url, init);
@@ -195,7 +195,10 @@ export default function Client(initialURL) {
195195
return false;
196196
}
197197
const mimeType = response.headers.get("content-type");
198-
if (!mimeType.startsWith("application/vnd.api+json")) {
198+
if (
199+
!(mimeType.startsWith("application/vnd.api+json") ||
200+
mimeType.startsWith("application/problem+json"))
201+
) {
199202
const problem = new UnexpectedContentTypeError(
200203
response,
201204
`the server responded in with an unrecognizable media type: ${mimeType}`,

0 commit comments

Comments
 (0)