From 55d4fbffcfcc1d8949afd9e65be491f30cbb4623 Mon Sep 17 00:00:00 2001 From: Pikachu Ren <40362270+PIKACHUIM@users.noreply.github.com> Date: Wed, 30 Apr 2025 11:28:42 +0800 Subject: [PATCH 1/2] change (Axios to Xior) 1.fix (Axios incompatible with Service Worker) 2.change (Axios to Xior) --- src/http.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/http.js b/src/http.js index 0e1b4dc..d52582a 100644 --- a/src/http.js +++ b/src/http.js @@ -55,7 +55,13 @@ class HttpClient { /* Request */ log(`HTTP request: ${method} ${url}`); - const resp = await axios.request(opts); + // const resp = await axios.request(opts); + let resp = await xior.request(opts); + const headers = {}; + for (const [key, value] of resp.headers) { + headers[key] = value; + } + resp.headers = headers log(`RESP ${resp.status} ${method} ${url}`); return resp; From ae0b3c4c29263dc83caa0147e36fddf424c758d0 Mon Sep 17 00:00:00 2001 From: Pikachu Ren <40362270+PIKACHUIM@users.noreply.github.com> Date: Wed, 30 Apr 2025 11:29:07 +0800 Subject: [PATCH 2/2] import(xior) --- src/http.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/http.js b/src/http.js index d52582a..1290836 100644 --- a/src/http.js +++ b/src/http.js @@ -5,7 +5,8 @@ const { createHmac, createSign, constants: { RSA_PKCS1_PADDING } } = require('crypto'); const { getJwk } = require('./crypto'); const { log } = require('./logger'); -const axios = require('./axios'); +// const axios = require('./axios'); +import xior from 'xior'; /** * ACME HTTP client