redux-saga-resources
Advanced tools
Comparing version 0.1.16 to 0.1.17
@@ -184,2 +184,13 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
} | ||
function headersToObject(headers) { | ||
if (headers.get && headers.keys) { | ||
const keys = headers.keys(); | ||
const res = {}; | ||
for (const key of keys) { | ||
res[key] = headers.get(key); | ||
} | ||
return res; | ||
} | ||
return headers; | ||
} | ||
export function* fetchMiddleware({ request, response, withResponse }, next) { | ||
@@ -199,3 +210,3 @@ const paramKeys = Object.keys(request.params); | ||
response.url = result.url; | ||
response.headers = result.headers; | ||
response.headers = headersToObject(result.headers); | ||
try { | ||
@@ -202,0 +213,0 @@ response.body = yield call(() => result.json()); |
@@ -211,2 +211,35 @@ 'use strict'; | ||
} | ||
function headersToObject(headers) { | ||
if (headers.get && headers.keys) { | ||
let keys = headers.keys(); | ||
let res = {}; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
try { | ||
for (var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
let key = _step.value; | ||
res[key] = headers.get(key); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
return res; | ||
} | ||
return headers; | ||
} | ||
function* fetchMiddleware(_ref3, next) { | ||
@@ -230,3 +263,3 @@ let request = _ref3.request, | ||
response.url = result.url; | ||
response.headers = result.headers; | ||
response.headers = headersToObject(result.headers); | ||
try { | ||
@@ -233,0 +266,0 @@ response.body = yield (0, _effects.call)(() => result.json()); |
{ | ||
"name": "redux-saga-resources", | ||
"version": "0.1.16", | ||
"version": "0.1.17", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "typings": "es6/index.d.ts", |
@@ -204,2 +204,13 @@ /* tslint:disable */ | ||
} | ||
function headersToObject(headers: any) { | ||
if (headers.get && headers.keys) { | ||
const keys = headers.keys(); | ||
const res: any = {}; | ||
for (const key of keys) { | ||
res[key] = headers.get(key); | ||
} | ||
return res; | ||
} | ||
return headers; | ||
} | ||
export function* fetchMiddleware({ request, response, withResponse }: any, next: any) { | ||
@@ -221,3 +232,3 @@ const paramKeys = Object.keys(request.params); | ||
response.url = result.url; | ||
response.headers = result.headers; | ||
response.headers = headersToObject(result.headers); | ||
try { | ||
@@ -224,0 +235,0 @@ response.body = yield call(() => result.json()); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
371352
5934