All files / server/test generic.js

81.82% Statements 9/11
50% Branches 2/4
100% Functions 2/2
80% Lines 8/10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 1511x   97x 97x 97x 97x 97x         97x 97x    
const normalize = require('./normalize');
 
module.exports = (app, request) => async (method, path, options) => {
  const res = await request(normalize(method, path, app.options.port, options));
  res.method = res.request.method;
  res.status = res.statusCode;
  Iif (/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;
};