thiagoluiznunes/mock-json-server

View on GitHub
components/mock/mock.helper.js

Summary

Maintainability
A
0 mins
Test Coverage
const asyncMiddleware = fn =>
  (req, res, next) => {
    Promise.resolve(fn(req, res, next))
      .catch(next);
  };

const retrieveRequestToken = async (req) => {
  const authorization = 'authorization';
  let token = req.body.token || req.query.token || req.headers[authorization];
  return token;
}

export default { asyncMiddleware, retrieveRequestToken };