'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.jsoniblePromise = jsoniblePromise;
// used for testing fetch calls that expect a
// promise returned by jsonify

function jsoniblePromise(resolutionValue) {
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

  var resolvePromise = new Promise(function (resolve, reject) {
    resolve(resolutionValue);
  });

  return {
    status: options.status || 200,
    headers: {
      get: function get(attr) {
        return Object.assign({
          'Content-Type': options.contentType || 'application/json; charset=utf-8'
        }, options.headers || {})[attr];
      }
    },
    json: function json() {
      return resolvePromise;
    }
  };
}

exports.default = function (res) {
  return res.json();
};