chore: gen api client
This commit is contained in:
parent
e14660ab32
commit
d20c63fd53
1 changed files with 7 additions and 1 deletions
|
|
@ -162,10 +162,16 @@ export const createClient = (config: Config = {}): Client => {
|
||||||
case "arrayBuffer":
|
case "arrayBuffer":
|
||||||
case "blob":
|
case "blob":
|
||||||
case "formData":
|
case "formData":
|
||||||
case "json":
|
|
||||||
case "text":
|
case "text":
|
||||||
data = await response[parseAs]();
|
data = await response[parseAs]();
|
||||||
break;
|
break;
|
||||||
|
case "json": {
|
||||||
|
// Some servers return 200 with no Content-Length and empty body.
|
||||||
|
// response.json() would throw; read as text and parse if non-empty.
|
||||||
|
const text = await response.text();
|
||||||
|
data = text ? JSON.parse(text) : {};
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "stream":
|
case "stream":
|
||||||
return opts.responseStyle === "data"
|
return opts.responseStyle === "data"
|
||||||
? response.body
|
? response.body
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue