| 312 | } |
| 313 | |
| 314 | post(t, e = (() => { |
| 315 | })) { |
| 316 | 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) => { |
| 317 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) |
| 318 | }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {hints: !1})), $task.fetch(t).then(t => { |
| 319 | const {statusCode: s, statusCode: i, headers: r, body: o} = t; |
| 320 | e(null, {status: s, statusCode: i, headers: r, body: o}, o) |
| 321 | }, t => e(t)); else if (this.isNode()) { |
| 322 | this.initGotEnv(t); |
| 323 | const {url: s, ...i} = t; |
| 324 | this.got.post(s, i).then(t => { |
| 325 | const {statusCode: s, statusCode: i, headers: r, body: o} = t; |
| 326 | e(null, {status: s, statusCode: i, headers: r, body: o}, o) |
| 327 | }, t => { |
| 328 | const {message: s, response: i} = t; |
| 329 | e(s, i, i && i.body) |
| 330 | }) |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | time(t, e = null) { |
| 335 | const s = e ? new Date(e) : new Date; |