Comparing version 0.1.9 to 0.1.10
@@ -87,2 +87,3 @@ import { Context, Service } from 'cordis'; | ||
static isAxiosError: typeof HTTPError.is; | ||
decoders: Dict; | ||
constructor(ctx: Context, config?: HTTP.Config, standalone?: boolean); | ||
@@ -89,0 +90,0 @@ static mergeConfig: (target: HTTP.Config, source?: HTTP.Config) => { |
@@ -58,2 +58,3 @@ var __defProp = Object.defineProperty; | ||
} | ||
decoders = /* @__PURE__ */ Object.create(null); | ||
static mergeConfig = (target, source) => ({ | ||
@@ -160,2 +161,4 @@ ...target, | ||
}; | ||
if (raw.redirected) | ||
return response; | ||
if (!raw.ok) { | ||
@@ -174,2 +177,6 @@ const error = new _HTTP.Error(raw.statusText); | ||
response.data = await raw.text(); | ||
} else if (config.responseType === "blob") { | ||
response.data = await raw.blob(); | ||
} else if (config.responseType === "formdata") { | ||
response.data = await raw.formData(); | ||
} else if (config.responseType === "stream") { | ||
@@ -176,0 +183,0 @@ response.data = raw.body; |
{ | ||
"name": "undios", | ||
"description": "Fetch-based axios-style HTTP client", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
@@ -139,2 +139,4 @@ import { Context, Service } from 'cordis' | ||
decoders: Dict = Object.create(null) | ||
constructor(ctx: Context, public config: HTTP.Config = {}, standalone?: boolean) { | ||
@@ -256,2 +258,5 @@ super(ctx, 'http', { immediate: true, standalone }) | ||
// 3xx redirects | ||
if (raw.redirected) return response | ||
if (!raw.ok) { | ||
@@ -270,2 +275,6 @@ const error = new HTTP.Error(raw.statusText) | ||
response.data = await raw.text() | ||
} else if (config.responseType === 'blob') { | ||
response.data = await raw.blob() | ||
} else if (config.responseType === 'formdata') { | ||
response.data = await raw.formData() | ||
} else if (config.responseType === 'stream') { | ||
@@ -272,0 +281,0 @@ response.data = raw.body |
Sorry, the diff of this file is not supported yet
34607
1026