Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Response } from "popsicle/dist/response";
export enum HTTPMethod {
GET = "GET",
POST = "POST",
PUT = "PUT",
PATCH = "PATCH",
DELETE = "DELETE",
HEAD = "HEAD",
OPTIONS = "OPTIONS",
}
export type methods = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
export class Request {
private readonly transport = Popsicle.createTransport({
rejectUnauthorized: false, // Need to tell node to ignore bad ssl cert
type: "text",
});
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,
};