Skip to content

Instantly share code, notes, and snippets.

@sergueyarellano
Created May 26, 2021 18:33
Show Gist options
  • Save sergueyarellano/f38becf5d1fa5af5e7eee5f6769b2ea8 to your computer and use it in GitHub Desktop.
Save sergueyarellano/f38becf5d1fa5af5e7eee5f6769b2ea8 to your computer and use it in GitHub Desktop.
function composeRequest (payload) {
const newPayload = cloneDeep(payload)
const { host, headers, method, endpoint } = get(payload, 'data.config', {})
const requestOptions = {
uri: new URL(endpoint, host),
options: {
headers,
method
}
}
return set(newPayload, 'data.request', requestOptions)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment