UNPKG
ghunti-devour-client
Version:
latest (2.0.6)
2.0.6
2.0.5
2.0.4
2.0.3
2.0.2
2.0.1
2.0.0
A lightweight, framework agnostic, flexible JSON API client
github.com/twg/devour
ghunti/devour
ghunti-devour-client
/
src
/
middleware
/
json-api
/
req-headers.js
13 lines
(11 loc)
•
303 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 } }