(options, callback)
| 432 | return response |
| 433 | } |
| 434 | const get = (options, callback) => { |
| 435 | if (isQuanX) { |
| 436 | if (typeof options == "string") options = { |
| 437 | url: options |
| 438 | } |
| 439 | options["method"] = "GET" |
| 440 | $task.fetch(options).then(response => { |
| 441 | callback(null, adapterStatus(response), response.body) |
| 442 | }, reason => callback(reason.error, null, null)) |
| 443 | } |
| 444 | if (isSurge) $httpClient.get(options, (error, response, body) => { |
| 445 | callback(error, adapterStatus(response), body) |
| 446 | }) |
| 447 | if (isNode) { |
| 448 | node.request(options, (error, response, body) => { |
| 449 | callback(error, adapterStatus(response), body) |
| 450 | }) |
| 451 | } |
| 452 | if (isJSBox) { |
| 453 | if (typeof options == "string") options = { |
| 454 | url: options |
| 455 | } |
| 456 | options["header"] = options["headers"] |
| 457 | options["handler"] = function (resp) { |
| 458 | let error = resp.error; |
| 459 | if (error) error = JSON.stringify(resp.error) |
| 460 | let body = resp.data; |
| 461 | if (typeof body == "object") body = JSON.stringify(resp.data); |
| 462 | callback(error, adapterStatus(resp.response), body) |
| 463 | }; |
| 464 | $http.get(options); |
| 465 | } |
| 466 | } |
| 467 | const post = (options, callback) => { |
| 468 | if (isQuanX) { |
| 469 | if (typeof options == "string") options = { |
nothing calls this directly
no test coverage detected