diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2026-06-26 22:06:55 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2026-06-26 22:06:55 +0300 |
| commit | 38cf35c2c24d2fb3bcc0ffc5e2ff6551d72e6eb8 (patch) | |
| tree | cc039d08513595fdc0c331145488584f45afde9f /src/http.ts | |
| parent | 24248be6e98e4d208a38a9b00e3be9aad6981632 (diff) | |
| download | the-epube-38cf35c2c24d2fb3bcc0ffc5e2ff6551d72e6eb8.tar.gz the-epube-38cf35c2c24d2fb3bcc0ffc5e2ff6551d72e6eb8.tar.xz | |
[ts-migrate][src] Run TS Migrate
Co-authored-by: ts-migrate <>
Diffstat (limited to 'src/http.ts')
| -rw-r--r-- | src/http.ts | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/http.ts b/src/http.ts index e66888c..2474eb5 100644 --- a/src/http.ts +++ b/src/http.ts @@ -23,7 +23,7 @@ class Http { * Set the CSRF token for subsequent requests. * @param {string} token */ - static setCsrfToken(token) { + static setCsrfToken(token: any) { Http._csrfToken = token; } @@ -34,7 +34,7 @@ class Http { * @param {Record<string, string> | null | undefined} params * @returns {string} */ - static _appendParams(url, params) { + static _appendParams(url: any, params: any) { if (!params || Object.keys(params).length === 0) return url; const separator = url.includes('?') ? '&' : '?'; const query = new URLSearchParams(params).toString(); @@ -47,15 +47,15 @@ class Http { * @param {Response} resp * @returns {never} */ - static _throwHttpError(resp) { + static _throwHttpError(resp: any) { /** @type {HttpError} */ const err = new Error(`HTTP ${resp.status}: ${resp.statusText}`); - err.status = resp.status; - err.responseText = ''; + (err as any).status = resp.status; + (err as any).responseText = ''; // Read error body asynchronously — don't block the throw - resp.text().then((t) => { err.responseText = t; }).catch(() => { - /* ignore */ - }); +resp.text().then((t: any) => { (err as any).responseText = t; }).catch(() => { + /* ignore */ +}); throw err; } @@ -65,7 +65,7 @@ class Http { * @param {Record<string, string> | null} [params] - optional query parameters * @returns {Promise<HttpResponse>} */ - static async get(url, params) { + static async get(url: any, params: any) { const urlWithParams = Http._appendParams(url, params); const resp = await fetch(urlWithParams, { method: 'GET', @@ -86,7 +86,7 @@ class Http { * @param {Record<string, string>} body * @returns {Promise<HttpResponse>} */ - static async post(url, body) { + static async post(url: any, body: any) { const params = new URLSearchParams(body); if (Http._csrfToken) { params.append('csrf_token', Http._csrfToken); @@ -112,7 +112,7 @@ class Http { * @param {Record<string, string> | null} [params] - optional query parameters * @returns {Promise<HttpBlobResponse>} */ - static async blob(url, params) { + static async blob(url: any, params: any) { const urlWithParams = Http._appendParams(url, params); const resp = await fetch(urlWithParams, { method: 'GET', @@ -133,7 +133,7 @@ class Http { * @param {Record<string, string> | null} [params] - optional query parameters * @returns {Promise<HttpTextResponse>} */ - static async text(url, params) { + static async text(url: any, params: any) { const urlWithParams = Http._appendParams(url, params); const resp = await fetch(urlWithParams, { method: 'GET', |
