Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public send(method: HTTPMethod | methods, url: string, body?: string): Promise {
const opts = {
body,
headers: {
"Content-Type": "application/json",
"X-Pact-Mock-Service": "true",
},
method,
timeout: 10000,
transport: this.transport,
url,
};
return Popsicle.request(opts)
.then((res: Response) => {
if (res.status >= 200 && res.status < 400) {
return res.body;
} else {
return Promise.reject(res.body);
}
});
}
}