1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 28x 138x 138x 137x 137x 137x 10x 10x 137x 137x | const normalize = require('./normalize'); module.exports = (app, request) => async (method, url, options) => { const res = await request(normalize(method, url, app.options.port, options)); res.method = res.request.method; res.status = res.statusCode; if (/application\/json/.test(res.headers['content-type']) && typeof res.body === 'string') { res.rawBody = res.body; res.body = JSON.parse(res.body); } // console.log(app); res.ctx = app; return res; }; |