dvf-client-js
Version:
<img src="https://avatars1.githubusercontent.com/u/56512535?s=200&v=4" align="right" />
16 lines (12 loc) • 335 B
JavaScript
const { post } = require('request-promise')
const _ = require('lodash')
module.exports = async (dvf, endpoint, json = {}, headers = {}) => {
const url = dvf.config.api + endpoint
const options = {
uri: url,
headers,
// removes null and undefined values
json: _.omitBy(json, _.isNil)
}
return post(options)
}