* HTTP request * * @param {string} url HTTP URL * @param {string} method HTTP method * @param {object} [opts] Request options * @returns {Promise } HTTP response
(url, method, opts = {})
| 47 | */ |
| 48 | |
| 49 | async request(url, method, opts = {}) { |
| 50 | opts.url = url; |
| 51 | opts.method = method; |
| 52 | opts.validateStatus = null; |
| 53 | console.log("Request URL: " + opts.url) |
| 54 | /* Headers */ |
| 55 | if (typeof opts.headers === 'undefined') { |
| 56 | opts.headers = {}; |
| 57 | } |
| 58 | |
| 59 | opts.headers['Content-Type'] = 'application/jose+json'; |
| 60 | |
| 61 | /* Request */ |
| 62 | log(`HTTP request: ${method} ${url}`); |
| 63 | // const resp = await axios.request(opts); |
| 64 | let resp = await xior.request(opts); |
| 65 | const headers = {}; |
| 66 | for (const [key, value] of resp.headers) { |
| 67 | headers[key] = value; |
| 68 | } |
| 69 | resp.headers = headers |
| 70 | |
| 71 | log(`RESP ${resp.status} ${method} ${url}`); |
| 72 | // return new_resp; |
| 73 | return resp; |
| 74 | } |
| 75 | /** |
| 76 | * Get ACME provider directory |
| 77 | * |
no outgoing calls
no test coverage detected