Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function fetch(config: Config, request: Request,
callback: (error: boolean, ctx: any) => void) {
var parsed_url = urllib.parse(request.url)
var options = {
hostname: parsed_url.hostname,
port: 443,
path: parsed_url.path,
method: request.method,
headers: {
"Accept": "application/json",
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
}
}
if (['POST', 'PUT', 'PATCH'].indexOf(request.method) >= 0) {
// GL browser should set this itself
//options.headers['Content-Length'] = payload.data.length;
options.headers['Content-Type'] = 'application/json'
}