| 228 | } |
| 229 | |
| 230 | post(t, e = (() => { |
| 231 | })) { |
| 232 | if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {"X-Surge-Skip-Scripting": !1})), $httpClient.post(t, (t, s, i) => { |
| 233 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) |
| 234 | }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {hints: !1})), $task.fetch(t).then(t => { |
| 235 | const {statusCode: s, statusCode: i, headers: r, body: o} = t; |
| 236 | e(null, {status: s, statusCode: i, headers: r, body: o}, o) |
| 237 | }, t => e(t)); else if (this.isNode()) { |
| 238 | this.initGotEnv(t); |
| 239 | const {url: s, ...i} = t; |
| 240 | this.got.post(s, i).then(t => { |
| 241 | const {statusCode: s, statusCode: i, headers: r, body: o} = t; |
| 242 | e(null, {status: s, statusCode: i, headers: r, body: o}, o) |
| 243 | }, t => { |
| 244 | const {message: s, response: i} = t; |
| 245 | e(s, i, i && i.body) |
| 246 | }) |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | time(t, e = null) { |
| 251 | const s = e ? new Date(e) : new Date(new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000); |