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 "blob":
|
||||
case "formData":
|
||||
case "json":
|
||||
case "text":
|
||||
data = await response[parseAs]();
|
||||
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":
|
||||
return opts.responseStyle === "data"
|
||||
? response.body
|
||||
|
|
|
|||
Loading…
Reference in a new issue