UNPKG
fractal-devour-client
Version:
latest (3.0.1)
3.0.1
3.0.0
2.3.0
2.1.1
2.1.0
2.0.15
A lightweight, framework agnostic, flexible JSON API client
github.com/twg/devour
twg/devour
fractal-devour-client
/
src
/
middleware
/
json-api
/
req-headers.js
13 lines
(11 loc)
•
319 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
const
_isEmpty =
require
(
'lodash/isEmpty'
)
const
_assign =
require
(
'lodash/assign'
)
module
.
exports
= {
name
:
'HEADER'
,
req
:
(
payload
) =>
{
if
(!
_isEmpty
(payload.
jsonApi
.
headers
)) { payload.
req
.
headers
=
_assign
({}, payload.
req
.
headers
, payload.
jsonApi
.
headers
) }
return
payload } }