Skip to content

Instantly share code, notes, and snippets.

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