| 414 | } |
| 415 | |
| 416 | async reqHandler(response) { |
| 417 | this.info.lastRequest = new Date().getTime(); |
| 418 | if (response) { |
| 419 | this.info.statusCode = response.status || 0; |
| 420 | if (response.request) this.info.lastURL = response.request.uri.href; |
| 421 | if (response.headers) { |
| 422 | this.info.usedWeight = response.headers['x-mbx-used-weight-1m'] || 0; |
| 423 | this.info.orderCount1s = response.headers['x-mbx-order-count-1s'] || 0; |
| 424 | this.info.orderCount1m = response.headers['x-mbx-order-count-1m'] || 0; |
| 425 | this.info.orderCount1h = response.headers['x-mbx-order-count-1h'] || 0; |
| 426 | this.info.orderCount1d = response.headers['x-mbx-order-count-1d'] || 0; |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | if (response && response.status !== 200) { |
| 431 | // let parsedResponse = ''; |
| 432 | // try { |
| 433 | // parsedResponse = await response.json(); |
| 434 | // } catch (e) { |
| 435 | // parsedResponse = await response.text(); |
| 436 | // } |
| 437 | const error = new Error(await response.text()); |
| 438 | // error.code = response.status; |
| 439 | // error.url = response.url; |
| 440 | throw error; |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | async proxyRequest(opt: any) { |
| 445 | const urlBody = new URLSearchParams(opt.form); |