Socket
Socket
Sign inDemoInstall

mockttp

Package Overview
Dependencies
24
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.11.0 to 0.12.0

4

custom-typings/fetch-ponyfill.d.ts
declare module 'fetch-ponyfill' {
function getFetch(): {
function getFetchPonyfill(): {
fetch: typeof fetch,

@@ -9,3 +9,3 @@ Headers: typeof Headers,

export = getFetch;
export = getFetchPonyfill;
}

@@ -20,4 +20,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -24,0 +24,0 @@ case 0: case 1: t = op; break;

@@ -22,2 +22,3 @@ /**

}
declare type SubscribableEvent = 'request' | 'response' | 'abort';
/**

@@ -35,6 +36,6 @@ * A Mockttp implementation, controlling a remote Mockttp standalone server.

constructor(mockServerOptions?: MockttpOptions);
private requestFromStandalone<T>(path, options?);
private openStreamToMockServer(config);
private requestFromMockServer<T>(path, options?);
private queryMockServer<T>(query, variables?);
private requestFromStandalone;
private openStreamToMockServer;
private requestFromMockServer;
private queryMockServer;
start(port?: number): Promise<void>;

@@ -47,4 +48,5 @@ stop(): Promise<void>;

addRule: (rule: MockRuleData) => Promise<MockedEndpoint>;
on(event: 'request' | 'response', callback: Function): Promise<void>;
on(event: SubscribableEvent, callback: (data: any) => void): Promise<void>;
private getEndpointData;
}
export {};

@@ -6,5 +6,8 @@ "use strict";

var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {

@@ -31,4 +34,4 @@ extendStatics(d, b);

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -54,3 +57,3 @@ case 0: case 1: t = op; break;

var TypedError = require("typed-error");
var getFetch = require("fetch-ponyfill");
var getFetchPonyfill = require("fetch-ponyfill");
var _ = require("lodash");

@@ -60,3 +63,3 @@ var WebSocket = require("universal-websocket-client");

var subscriptions_transport_ws_1 = require("subscriptions-transport-ws");
var _a = getFetch(),
var _a = getFetchPonyfill(),
/** @hidden */

@@ -99,2 +102,7 @@ fetch = _a.fetch,

exports.GraphQLError = GraphQLError;
var SUBSCRIBABLE_EVENTS = [
'request',
'response',
'abort'
];
/**

@@ -344,14 +352,25 @@ * A Mockttp implementation, controlling a remote Mockttp standalone server.

var _this = this;
if (!_.includes(['request', 'response'], event))
if (!_.includes(SUBSCRIBABLE_EVENTS, event))
return Promise.resolve();
var url = "ws://localhost:" + types_1.DEFAULT_STANDALONE_PORT + "/server/" + this.mockServerConfig.port + "/subscription";
var client = new subscriptions_transport_ws_1.SubscriptionClient(url, {}, WebSocket);
var queryResultName = event === 'request' ? 'requestReceived' : 'responseCompleted';
var query = event === 'request' ? {
operationName: 'OnRequest',
query: "subscription OnRequest {\n " + queryResultName + " {\n id,\n protocol,\n method,\n url,\n path,\n hostname,\n\n headers,\n body\n }\n }"
} : {
operationName: 'OnResponse',
query: "subscription OnResponse {\n " + queryResultName + " {\n id,\n statusCode,\n statusMessage,\n headers,\n body\n }\n }"
};
var queryResultName = {
request: 'requestReceived',
response: 'responseCompleted',
abort: 'requestAborted'
}[event];
var query = {
request: {
operationName: 'OnRequest',
query: "subscription OnRequest {\n " + queryResultName + " {\n id,\n protocol,\n method,\n url,\n path,\n hostname,\n\n headers,\n body\n }\n }"
},
response: {
operationName: 'OnResponse',
query: "subscription OnResponse {\n " + queryResultName + " {\n id,\n statusCode,\n statusMessage,\n headers,\n body\n }\n }"
},
abort: {
operationName: 'OnAbort',
query: "subscription OnAbort {\n " + queryResultName + " {\n id,\n protocol,\n method,\n url,\n path,\n hostname,\n\n headers,\n body\n }\n }"
},
}[event];
client.request(query).subscribe({

@@ -358,0 +377,0 @@ next: function (value) {

@@ -0,1 +1,4 @@

/**
* @module Mockttp
*/
import { MockttpStandalone, StandaloneServerOptions } from "./standalone/mockttp-standalone";

@@ -2,0 +5,0 @@ import { Mockttp, MockttpOptions } from "./mockttp";

@@ -131,3 +131,3 @@ import MockRuleBuilder from "./rules/mock-rule-builder";

/**
* Subscribe to hear about response details as the response is completed.
* Subscribe to hear about response details when the response is completed.
*

@@ -142,2 +142,13 @@ * This is only useful in some niche use cases, such as logging all requests seen

on(event: 'response', callback: (req: CompletedResponse) => void): Promise<void>;
/**
* Subscribe to hear about requests that are aborted before the response is completed.
*
* This is only useful in some niche use cases, such as logging all requests seen
* by the server independently of the rules defined.
*
* The callback will be called asynchronously from request handling. This function
* returns a promise, and the callback is not guaranteed to be registered until
* the promise is resolved.
*/
on(event: 'abort', callback: (req: CompletedRequest) => void): Promise<void>;
}

@@ -155,3 +166,3 @@ export interface MockttpOptions {

protected debug: boolean;
readonly abstract url: string;
abstract readonly url: string;
abstract addRule: (ruleData: MockRuleData) => Promise<MockedEndpoint>;

@@ -158,0 +169,0 @@ abstract on(event: 'request', callback: (req: CompletedRequest) => void): Promise<void>;

@@ -6,5 +6,8 @@ "use strict";

var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {

@@ -11,0 +14,0 @@ extendStatics(d, b);

@@ -0,3 +1,5 @@

/**
* @module MockRuleData
*/
/// <reference types="node" />
/// <reference types="express" />
import express = require("express");

@@ -14,4 +16,4 @@ import { Readable } from 'stream';

status: number;
data: string | Buffer | SerializedBuffer | undefined;
headers: Headers | undefined;
data?: string | Buffer | SerializedBuffer | undefined;
headers?: Headers | undefined;
readonly type: 'simple';

@@ -46,3 +48,3 @@ constructor(status: number, data?: string | Buffer | SerializedBuffer | undefined, headers?: Headers | undefined);

serialize(options?: SerializationOptions): SerializedCallbackHandlerData;
static deserialize({topicId, name}: SerializedCallbackHandlerData, options?: SerializationOptions): CallbackHandlerData;
static deserialize({ topicId, name }: SerializedCallbackHandlerData, options?: SerializationOptions): CallbackHandlerData;
}

@@ -58,3 +60,3 @@ export interface SerializedStreamHandlerData extends SerializedStreamBackedHandlerData {

};
headers: Headers | undefined;
headers?: Headers | undefined;
readonly type: 'stream';

@@ -71,3 +73,3 @@ constructor(status: number, stream: Readable & {

export declare class PassThroughHandlerData extends Serializable {
private forwardToLocation;
private forwardToLocation?;
readonly type: 'passthrough';

@@ -74,0 +76,0 @@ constructor(forwardToLocation?: string | undefined);

@@ -6,5 +6,8 @@ "use strict";

var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {

@@ -35,4 +38,4 @@ extendStatics(d, b);

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -299,3 +302,3 @@ case 0: case 1: t = op; break;

}
callback(null, JSON.stringify({
callback(undefined, JSON.stringify({
topicId: topicId,

@@ -376,8 +379,8 @@ event: 'data',

return _.assign(function (clientReq, clientRes) { return __awaiter(_this, void 0, void 0, function () {
var method, originalUrl, headers, _a, protocol, hostname, port, path, socket, remoteAddress, remotePort, hostHeader, makeRequest, outgoingPort, _b, _c;
var _a, _b, method, originalUrl, headers, _c, protocol, hostname, port, path, socket, remoteAddress, remotePort, hostHeader, makeRequest, outgoingPort;
return __generator(this, function (_d) {
method = clientReq.method, originalUrl = clientReq.originalUrl, headers = clientReq.headers;
_a = url.parse(originalUrl), protocol = _a.protocol, hostname = _a.hostname, port = _a.port, path = _a.path;
_c = url.parse(originalUrl), protocol = _c.protocol, hostname = _c.hostname, port = _c.port, path = _c.path;
if (this.forwardToLocation) {
(_b = url.parse(this.forwardToLocation), protocol = _b.protocol, hostname = _b.hostname, port = _b.port);
(_a = url.parse(this.forwardToLocation), protocol = _a.protocol, hostname = _a.hostname, port = _a.port);
}

@@ -396,3 +399,3 @@ socket = clientReq.socket;

if (!hostname) {
_c = hostHeader.split(':'), hostname = _c[0], port = _c[1];
_b = hostHeader.split(':'), hostname = _b[0], port = _b[1];
protocol = clientReq.protocol + ':';

@@ -426,4 +429,2 @@ }

});
clientRes.on('close', function () { return serverReq.abort(); });
socket.once('error', function (e) { return serverReq.abort(); });
serverReq.once('socket', function (socket) {

@@ -443,3 +444,7 @@ // We want the local port - it's not available until we actually connect

clientReq.body.rawStream.pipe(serverReq);
clientReq.body.rawStream.once('error', function () { return serverReq.abort(); });
clientRes.once('close', function () { return serverReq.abort(); });
serverReq.once('error', function (e) {
if (serverReq.aborted)
return;
e.statusCode = 502;

@@ -446,0 +451,0 @@ e.statusMessage = 'Error communicating with upstream server';

@@ -0,1 +1,4 @@

/**
* @module MockRuleData
*/
import { OngoingRequest, Method } from "../types";

@@ -2,0 +5,0 @@ import { RequestMatcher } from "./mock-rule-types";

@@ -6,5 +6,8 @@ "use strict";

var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {

@@ -35,4 +38,4 @@ extendStatics(d, b);

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -144,3 +147,3 @@ case 0: case 1: t = op; break;

var _this = this;
var lowerCasedHeaders = _.mapKeys(this.headers, function (value, key) { return key.toLowerCase(); });
var lowerCasedHeaders = _.mapKeys(this.headers, function (_value, key) { return key.toLowerCase(); });
return _.assign(function (request) { return _.isMatch(request.headers, lowerCasedHeaders); }, { explain: function () { return "with headers including " + JSON.stringify(_this.headers); } });

@@ -260,9 +263,3 @@ };

exports.buildMatchers = buildMatchers;
function combineMatchers(matcherA, matcherB) {
return _.assign(function (request) { return matcherA(request) && matcherB(request); }, { explain: function () {
return matcherA.explain.apply(this) + " and " + matcherB.explain.apply(this);
} });
}
;
var templateObject_1;
//# sourceMappingURL=matchers.js.map

@@ -0,1 +1,4 @@

/**
* @module MockRule
*/
/// <reference types="node" />

@@ -110,5 +113,6 @@ import { OutgoingHttpHeaders } from "http";

*
* The callback should return an object, potentially including various
* fields to define the response. All fields are optional, and default
* to being empty/blank, except for the status, which defaults to 200.
* The callback should return a response object or a promise for one.
* The response object may include various fields to define the response.
* All fields are optional, and default to being empty/blank, except for
* the status, which defaults to 200.
*

@@ -132,3 +136,3 @@ * Valid fields are:

*/
thenCallback(callback: (request: CompletedRequest) => CallbackHandlerResult): Promise<MockedEndpoint>;
thenCallback(callback: (request: CompletedRequest) => CallbackHandlerResult | Promise<CallbackHandlerResult>): Promise<MockedEndpoint>;
/**

@@ -135,0 +139,0 @@ * Respond immediately with the given status (and optionally, headers),

@@ -24,4 +24,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -201,5 +201,6 @@ case 0: case 1: t = op; break;

*
* The callback should return an object, potentially including various
* fields to define the response. All fields are optional, and default
* to being empty/blank, except for the status, which defaults to 200.
* The callback should return a response object or a promise for one.
* The response object may include various fields to define the response.
* All fields are optional, and default to being empty/blank, except for
* the status, which defaults to 200.
*

@@ -206,0 +207,0 @@ * Valid fields are:

@@ -0,1 +1,4 @@

/**
* @module MockRule
*/
import { SerializationOptions } from '../util/serialization';

@@ -16,5 +19,5 @@ import { CompletedRequest } from "../types";

requests: Promise<CompletedRequest>[];
constructor({matchers, handler, completionChecker}: MockRuleData);
private recordRequests(handler);
constructor({ matchers, handler, completionChecker }: MockRuleData);
private recordRequests;
explain(): string;
}

@@ -20,4 +20,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -24,0 +24,0 @@ case 0: case 1: t = op; break;

@@ -17,4 +17,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -21,0 +21,0 @@ case 0: case 1: t = op; break;

@@ -0,1 +1,4 @@

/**
* @module Mockttp
*/
import { CompletedRequest, CompletedResponse } from "../types";

@@ -24,2 +27,3 @@ import { MockRuleData } from "../rules/mock-rule-types";

readonly mockedEndpoints: MockedEndpoint[];
private readonly address;
readonly url: string;

@@ -30,8 +34,11 @@ readonly port: number;

on(event: 'response', callback: (req: CompletedResponse) => void): Promise<void>;
private announceRequestAsync(request);
private announceResponseAsync(response);
private handleRequest(request, rawResponse);
on(event: 'abort', callback: (req: CompletedRequest) => void): Promise<void>;
private announceRequestAsync;
private announceResponseAsync;
private announceAbortAsync;
private handleRequest;
private isComplete;
private explainRequest(request);
private suggestRule(request);
private sendUnmatchedRequestError;
private explainRequest;
private suggestRule;
}

@@ -6,5 +6,8 @@ "use strict";

var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {

@@ -31,4 +34,4 @@ extendStatics(d, b);

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -111,4 +114,4 @@ case 0: case 1: t = op; break;

return __awaiter(this, void 0, void 0, function () {
var port, _a, _b;
var _this = this;
var port, _a, _b;
return __generator(this, function (_c) {

@@ -199,2 +202,11 @@ switch (_c.label) {

});
Object.defineProperty(MockttpServer.prototype, "address", {
get: function () {
if (!this.server)
throw new Error('Cannot get address before server is started');
return this.server.address();
},
enumerable: true,
configurable: true
});
Object.defineProperty(MockttpServer.prototype, "url", {

@@ -205,6 +217,6 @@ get: function () {

if (this.httpsOptions) {
return "https://localhost:" + this.server.address().port;
return "https://localhost:" + this.address.port;
}
else {
return "http://localhost:" + this.server.address().port;
return "http://localhost:" + this.address.port;
}

@@ -219,3 +231,3 @@ },

throw new Error('Cannot get port before server is started');
return this.server.address().port;
return this.address.port;
},

@@ -249,8 +261,22 @@ enumerable: true,

};
MockttpServer.prototype.announceAbortAsync = function (request) {
return __awaiter(this, void 0, void 0, function () {
var req;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, request_utils_1.waitForCompletedRequest(request)];
case 1:
req = _a.sent();
this.eventEmitter.emit('abort', req);
return [2 /*return*/];
}
});
});
};
MockttpServer.prototype.handleRequest = function (request, rawResponse) {
return __awaiter(this, void 0, void 0, function () {
var response, id, result, matchingRules_1, nextRule, e_1;
var _this = this;
var response, id, matchingRules_1, nextRule, requestExplanation, _a, _b, e_1;
return __generator(this, function (_c) {
switch (_c.label) {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:

@@ -264,8 +290,16 @@ if (this.debug)

this.announceRequestAsync(request);
_c.label = 1;
result = null;
response.once('close', function () {
// Aborted is only defined in new node. We use it where it's explicitly false though.
if (result === null && (request.aborted !== false)) {
_this.announceAbortAsync(request);
result = 'aborted';
}
});
_a.label = 1;
case 1:
_c.trys.push([1, 8, , 9]);
_a.trys.push([1, 7, , 8]);
return [4 /*yield*/, promise_1.filter(this.rules, function (r) { return r.matches(request); })];
case 2:
matchingRules_1 = _c.sent();
matchingRules_1 = _a.sent();
nextRule = matchingRules_1.filter(function (r) { return !_this.isComplete(r, matchingRules_1); })[0];

@@ -277,28 +311,13 @@ if (!nextRule) return [3 /*break*/, 4];

case 3:
_c.sent();
return [3 /*break*/, 7];
case 4: return [4 /*yield*/, this.explainRequest(request)];
_a.sent();
return [3 /*break*/, 6];
case 4: return [4 /*yield*/, this.sendUnmatchedRequestError(request, response)];
case 5:
requestExplanation = _c.sent();
if (this.debug)
console.warn("Unmatched request received: " + requestExplanation);
response.setHeader('Content-Type', 'text/plain');
response.writeHead(503, "Request for unmocked endpoint");
response.write("No rules were found matching this request.\n");
response.write("This request was: " + requestExplanation + "\n\n");
if (this.rules.length > 0) {
response.write("The configured rules are:\n");
this.rules.forEach(function (rule) { return response.write(rule.explain() + "\n"); });
}
else {
response.write("There are no rules configured.\n");
}
_b = (_a = response).end;
return [4 /*yield*/, this.suggestRule(request)];
_a.sent();
_a.label = 6;
case 6:
_b.apply(_a, [_c.sent()]);
_c.label = 7;
case 7: return [3 /*break*/, 9];
case 8:
e_1 = _c.sent();
result = result || 'responded';
return [3 /*break*/, 8];
case 7:
e_1 = _a.sent();
if (this.debug) {

@@ -319,7 +338,12 @@ console.error("Failed to handle request:", e_1);

response.end(e_1.toString());
result = result || 'responded';
}
catch (e) { }
return [3 /*break*/, 9];
case 9:
this.announceResponseAsync(response);
catch (e) {
this.announceAbortAsync(request);
}
return [3 /*break*/, 8];
case 8:
if (result === 'responded') {
this.announceResponseAsync(response);
}
return [2 /*return*/];

@@ -330,2 +354,32 @@ }

};
MockttpServer.prototype.sendUnmatchedRequestError = function (request, response) {
return __awaiter(this, void 0, void 0, function () {
var requestExplanation, _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4 /*yield*/, this.explainRequest(request)];
case 1:
requestExplanation = _c.sent();
if (this.debug)
console.warn("Unmatched request received: " + requestExplanation);
response.setHeader('Content-Type', 'text/plain');
response.writeHead(503, "Request for unmocked endpoint");
response.write("No rules were found matching this request.\n");
response.write("This request was: " + requestExplanation + "\n\n");
if (this.rules.length > 0) {
response.write("The configured rules are:\n");
this.rules.forEach(function (rule) { return response.write(rule.explain() + "\n"); });
}
else {
response.write("There are no rules configured.\n");
}
_b = (_a = response).end;
return [4 /*yield*/, this.suggestRule(request)];
case 2:
_b.apply(_a, [_c.sent()]);
return [2 /*return*/];
}
});
});
};
MockttpServer.prototype.explainRequest = function (request) {

@@ -332,0 +386,0 @@ return __awaiter(this, void 0, void 0, function () {

@@ -1,2 +0,4 @@

/// <reference types="express" />
/**
* @module Internal
*/
/// <reference types="node" />

@@ -3,0 +5,0 @@ import * as express from 'express';

@@ -20,4 +20,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -135,6 +135,11 @@ case 0: case 1: t = op; break;

buffer: body,
get decodedBuffer() {
return runOrUndefined(function () {
return handleContentEncoding(body, headers['content-encoding']);
});
},
get text() {
var _this = this;
return runOrUndefined(function () {
return handleContentEncoding(body, headers['content-encoding'])
.toString('utf8');
return _this.decodedBuffer.toString('utf8');
});

@@ -149,3 +154,3 @@ },

return runOrUndefined(function () {
return completedBody.text && querystring.parse(completedBody.text);
return completedBody.text ? querystring.parse(completedBody.text) : undefined;
});

@@ -152,0 +157,0 @@ }

@@ -0,1 +1,4 @@

/**
* @module Mockttp
*/
/// <reference path="../../custom-typings/asynciterator.d.ts" />

@@ -13,3 +16,3 @@ import { MockttpOptions } from '../mockttp';

constructor(options?: StandaloneServerOptions);
private loadSchema(schemaFilename, mockServer, stream);
private loadSchema;
start(standalonePort?: number): Promise<void>;

@@ -19,3 +22,3 @@ private routers;

private streamServers;
private startMockServer(options, port?);
private startMockServer;
stop(): Promise<void>;

@@ -22,0 +25,0 @@ }

@@ -20,4 +20,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -173,4 +173,4 @@ case 0: case 1: t = op; break;

return __awaiter(this, void 0, void 0, function () {
var mockServer, mockPort, mockServerRouter, serverSideStream, clientSideStream, schema;
var _this = this;
var mockServer, mockPort, mockServerRouter, serverSideStream, clientSideStream, schema;
return __generator(this, function (_a) {

@@ -177,0 +177,0 @@ switch (_a.label) {

@@ -0,1 +1,2 @@

#!/usr/bin/env node
export {};

@@ -18,4 +18,4 @@ #!/usr/bin/env node

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -22,0 +22,0 @@ case 0: case 1: t = op; break;

@@ -0,1 +1,4 @@

/**
* @module Internal
*/
/// <reference types="node" />

@@ -2,0 +5,0 @@ import { IResolvers } from "graphql-tools/dist/Interfaces";

@@ -5,9 +5,12 @@ "use strict";

*/
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};

@@ -29,4 +32,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -57,2 +60,3 @@ case 0: case 1: t = op; break;

var RESPONSE_COMPLETED_TOPIC = 'response-completed';
var REQUEST_ABORTED_TOPIC = 'request-aborted';
function astToObject(ast) {

@@ -180,2 +184,7 @@ return _.zipObject(ast.fields.map(function (f) { return f.name.value; }), ast.fields.map(function (f) { return parseAnyAst(f.value); }));

});
mockServer.on('abort', function (request) {
pubsub.publish(REQUEST_ABORTED_TOPIC, {
requestAborted: request
});
});
return __assign({ Query: {

@@ -213,3 +222,6 @@ mockedEndpoints: function () {

subscribe: function () { return pubsub.asyncIterator(RESPONSE_COMPLETED_TOPIC); }
}
},
requestAborted: {
subscribe: function () { return pubsub.asyncIterator(REQUEST_ABORTED_TOPIC); }
},
}, Request: {

@@ -216,0 +228,0 @@ body: function (request) {

@@ -1,5 +0,5 @@

/// <reference types="node" />
/**
* @module Internal
*/
/// <reference types="node" />
import stream = require('stream');

@@ -15,3 +15,3 @@ import express = require("express");

HEAD = 5,
OPTIONS = 6,
OPTIONS = 6
}

@@ -40,3 +40,3 @@ export interface Headers {

asFormData: () => Promise<{
[key: string]: string;
[key: string]: string | string[];
}>;

@@ -49,3 +49,3 @@ }

formData: {
[key: string]: string;
[key: string]: string | string[];
} | undefined;

@@ -52,0 +52,0 @@ }

@@ -1,5 +0,5 @@

/// <reference types="node" />
/**
* @module Internal
*/
/// <reference types="node" />
import net = require("net");

@@ -6,0 +6,0 @@ export interface DestroyableServer extends net.Server {

@@ -0,3 +1,6 @@

/**
* @module Internal
*/
/// <reference types="node" />
export declare function readFile(filename: string, encoding: null): Promise<Buffer>;
export declare function readFile(filename: string, encoding: string): Promise<string>;

@@ -0,1 +1,4 @@

/**
* @module Internal
*/
export default function normalize(url: string): string;

@@ -11,3 +11,3 @@ "use strict";

removeTrailingSlash: false,
removeQueryParameters: [/.*/g],
removeQueryParameters: [/.*/],
});

@@ -14,0 +14,0 @@ }

@@ -20,4 +20,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -24,0 +24,0 @@ case 0: case 1: t = op; break;

@@ -0,1 +1,4 @@

/**
* @module TLS
*/
/// <reference types="node" />

@@ -2,0 +5,0 @@ export declare type CAOptions = (HttpsOptions | HttpsPathOptions);

@@ -20,4 +20,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -24,0 +24,0 @@ case 0: case 1: t = op; break;

{
"name": "mockttp",
"version": "0.11.0",
"version": "0.12.0",
"description": "Mock HTTP server for testing HTTP clients and stubbing webservices",

@@ -24,4 +24,4 @@ "main": "dist/main.js",

"build:doc": "typedoc --excludeExternals --readme none --exclude '**/+(main-browser|standalone-bin).ts' --out typedoc/ src/ custom-typings/",
"test": "npm run build && npm run test:mocha && npm run test:browser",
"test:mocha": "NODE_EXTRA_CA_CERTS=./test/fixtures/test-ca.pem mocha -r ts-node/register 'test/**/*.spec.ts'",
"test": "npm run build && npm run test:node && npm run test:browser",
"test:node": "NODE_EXTRA_CA_CERTS=./test/fixtures/test-ca.pem mocha -r ts-node/register 'test/**/*.spec.ts'",
"test:browser": "ts-node ./src/standalone/standalone-bin.ts -c karma start",

@@ -99,3 +99,3 @@ "test:browser:debug": "ts-node ./src/standalone/standalone-bin.ts -c karma start --single-run=false",

"typedoc-plugin-external-module-name": "^1.1.1",
"typescript": "^2.7.1",
"typescript": "^3.1.6",
"url-search-params": "^0.10.0",

@@ -105,7 +105,7 @@ "webpack": "^3.7.1"

"engines": {
"node": ">=4.0.0"
"node": ">=6.0.0"
},
"dependencies": {
"@types/express": "^4.0.33",
"@types/node": "^6.0.45",
"@types/node": "^10.12.9",
"apollo-server-express": "^1.1.0",

@@ -112,0 +112,0 @@ "base64-arraybuffer": "^0.1.5",

@@ -6,3 +6,3 @@ /**

import TypedError = require('typed-error');
import getFetch = require('fetch-ponyfill');
import getFetchPonyfill = require('fetch-ponyfill');
import _ = require('lodash');

@@ -18,5 +18,5 @@ import * as WebSocket from 'universal-websocket-client';

Headers
} = getFetch();
} = getFetchPonyfill();
import { MockedEndpoint, CompletedRequest } from "../types";
import { MockedEndpoint } from "../types";
import {

@@ -56,2 +56,10 @@ MockRuleData

type SubscribableEvent = 'request' | 'response' | 'abort';
const SUBSCRIBABLE_EVENTS: SubscribableEvent[] = [
'request',
'response',
'abort'
];
/**

@@ -233,4 +241,4 @@ * A Mockttp implementation, controlling a remote Mockttp standalone server.

public on(event: 'request' | 'response', callback: Function): Promise<void> {
if (!_.includes(['request', 'response'], event)) return Promise.resolve();
public on(event: SubscribableEvent, callback: (data: any) => void): Promise<void> {
if (!_.includes(SUBSCRIBABLE_EVENTS, event)) return Promise.resolve();

@@ -240,32 +248,55 @@ const url = `ws://localhost:${DEFAULT_STANDALONE_PORT}/server/${this.mockServerConfig!.port}/subscription`;

const queryResultName = event === 'request' ? 'requestReceived' : 'responseCompleted';
const queryResultName = {
request: 'requestReceived',
response: 'responseCompleted',
abort: 'requestAborted'
}[event];
const query = event === 'request' ? {
operationName: 'OnRequest',
query: `subscription OnRequest {
${queryResultName} {
id,
protocol,
method,
url,
path,
hostname,
const query = {
request: {
operationName: 'OnRequest',
query: `subscription OnRequest {
${queryResultName} {
id,
protocol,
method,
url,
path,
hostname,
headers,
body
}
}`
} : {
operationName: 'OnResponse',
query: `subscription OnResponse {
${queryResultName} {
id,
statusCode,
statusMessage,
headers,
body
}
}`
}
headers,
body
}
}`
},
response: {
operationName: 'OnResponse',
query: `subscription OnResponse {
${queryResultName} {
id,
statusCode,
statusMessage,
headers,
body
}
}`
},
abort: {
operationName: 'OnAbort',
query: `subscription OnAbort {
${queryResultName} {
id,
protocol,
method,
url,
path,
hostname,
headers,
body
}
}`
},
}[event];
client.request(query).subscribe({

@@ -272,0 +303,0 @@ next: (value) => {

@@ -145,3 +145,3 @@ /**

/**
* Subscribe to hear about response details as the response is completed.
* Subscribe to hear about response details when the response is completed.
*

@@ -156,2 +156,14 @@ * This is only useful in some niche use cases, such as logging all requests seen

on(event: 'response', callback: (req: CompletedResponse) => void): Promise<void>;
/**
* Subscribe to hear about requests that are aborted before the response is completed.
*
* This is only useful in some niche use cases, such as logging all requests seen
* by the server independently of the rules defined.
*
* The callback will be called asynchronously from request handling. This function
* returns a promise, and the callback is not guaranteed to be registered until
* the promise is resolved.
*/
on(event: 'abort', callback: (req: CompletedRequest) => void): Promise<void>;
}

@@ -158,0 +170,0 @@

@@ -299,3 +299,3 @@ /**

callback(null, JSON.stringify(<StreamHandlerMessage> {
callback(undefined, JSON.stringify(<StreamHandlerMessage> {
topicId,

@@ -402,6 +402,6 @@ event: 'data',

// If it's ipv4 masquerading as v6, strip back to ipv4
const remoteAddress = socket.remoteAddress.replace(/^::ffff:/, '');
const remoteAddress = socket.remoteAddress!.replace(/^::ffff:/, '');
const remotePort = port ? Number.parseInt(port) : socket.remotePort;
if (isRequestLoop(remoteAddress, remotePort)) {
if (isRequestLoop(remoteAddress, remotePort!)) {
throw new Error(stripIndent`

@@ -454,5 +454,2 @@ Passthrough loop detected. This probably means you're sending a request directly ${''

clientRes.on('close', () => serverReq.abort());
socket.once('error', (e) => serverReq.abort());
serverReq.once('socket', (socket: net.Socket) => {

@@ -475,4 +472,8 @@ // We want the local port - it's not available until we actually connect

clientReq.body.rawStream.pipe(serverReq);
clientReq.body.rawStream.once('error', () => serverReq.abort());
clientRes.once('close', () => serverReq.abort());
serverReq.once('error', (e: any) => {
if ((<any>serverReq).aborted) return;
e.statusCode = 502;

@@ -479,0 +480,0 @@ e.statusMessage = 'Error communicating with upstream server';

@@ -98,3 +98,3 @@ /**

buildMatcher() {
let lowerCasedHeaders = _.mapKeys(this.headers, (value: string, key: string) => key.toLowerCase());
let lowerCasedHeaders = _.mapKeys(this.headers, (_value: string, key: string) => key.toLowerCase());
return _.assign(

@@ -200,11 +200,2 @@ (request: OngoingRequest) => _.isMatch(request.headers, lowerCasedHeaders)

} });
}
function combineMatchers(matcherA: RequestMatcher, matcherB: RequestMatcher): RequestMatcher {
return _.assign(
(request: OngoingRequest) => matcherA(request) && matcherB(request),
{ explain: function (this: MockRule) {
return `${matcherA.explain.apply(this)} and ${matcherB.explain.apply(this)}`;
} }
);
};
}

@@ -229,7 +229,8 @@ /**

* and build a response from the result.
*
* The callback should return an object, potentially including various
* fields to define the response. All fields are optional, and default
* to being empty/blank, except for the status, which defaults to 200.
*
*
* The callback should return a response object or a promise for one.
* The response object may include various fields to define the response.
* All fields are optional, and default to being empty/blank, except for
* the status, which defaults to 200.
*
* Valid fields are:

@@ -240,9 +241,9 @@ * - `status` (number)

* - `json` (object, which will be sent as a JSON response)
*
*
* If the callback throws an exception, the server will return a 500
* with the exception message.
*
*
* Calling this method registers the rule with the server, so it
* starts to handle requests.
*
*
* This method returns a promise that resolves with a mocked endpoint.

@@ -253,3 +254,5 @@ * Wait for the promise to confirm that the rule has taken effect

*/
thenCallback(callback: (request: CompletedRequest) => CallbackHandlerResult): Promise<MockedEndpoint> {
thenCallback(callback:
(request: CompletedRequest) => CallbackHandlerResult | Promise<CallbackHandlerResult>
): Promise<MockedEndpoint> {
const rule: MockRuleData = {

@@ -256,0 +259,0 @@ matchers: this.matchers,

@@ -133,2 +133,8 @@ /**

private get address() {
if (!this.server) throw new Error('Cannot get address before server is started');
return (this.server.address() as net.AddressInfo)
}
get url(): string {

@@ -138,5 +144,5 @@ if (!this.server) throw new Error('Cannot get url before server is started');

if (this.httpsOptions) {
return "https://localhost:" + this.server.address().port;
return "https://localhost:" + this.address.port;
} else {
return "http://localhost:" + this.server.address().port;
return "http://localhost:" + this.address.port;
}

@@ -148,3 +154,3 @@ }

return this.server.address().port;
return this.address.port;
}

@@ -160,3 +166,4 @@

public on(event: 'response', callback: (req: CompletedResponse) => void): Promise<void>;
public on(event: string, callback: Function): Promise<void> {
public on(event: 'abort', callback: (req: CompletedRequest) => void): Promise<void>;
public on(event: string, callback: (...args: any[]) => void): Promise<void> {
this.eventEmitter.on(event, callback);

@@ -186,2 +193,7 @@ return Promise.resolve();

private async announceAbortAsync(request: OngoingRequest) {
const req = await waitForCompletedRequest(request);
this.eventEmitter.emit('abort', req);
}
private async handleRequest(request: OngoingRequest, rawResponse: express.Response) {

@@ -199,2 +211,11 @@ if (this.debug) console.log(`Handling request for ${request.url}`);

let result: 'responded' | 'aborted' | null = null;
response.once('close', () => {
// Aborted is only defined in new node. We use it where it's explicitly false though.
if (result === null && ((request as any).aborted !== false)) {
this.announceAbortAsync(request);
result = 'aborted';
}
});
try {

@@ -208,20 +229,5 @@ let matchingRules = await filter(this.rules, (r) => r.matches(request));

} else {
let requestExplanation = await this.explainRequest(request);
if (this.debug) console.warn(`Unmatched request received: ${requestExplanation}`);
response.setHeader('Content-Type', 'text/plain');
response.writeHead(503, "Request for unmocked endpoint");
response.write("No rules were found matching this request.\n");
response.write(`This request was: ${requestExplanation}\n\n`);
if (this.rules.length > 0) {
response.write("The configured rules are:\n");
this.rules.forEach((rule) => response.write(rule.explain() + "\n"));
} else {
response.write("There are no rules configured.\n");
}
response.end(await this.suggestRule(request));
await this.sendUnmatchedRequestError(request, response);
}
result = result || 'responded';
} catch (e) {

@@ -239,6 +245,13 @@ if (this.debug) {

try { response.writeHead(e.statusCode || 500, e.statusMessage || 'Server error'); } catch (e) {}
try { response.end(e.toString()); } catch (e) {}
try {
response.end(e.toString());
result = result || 'responded';
} catch (e) {
this.announceAbortAsync(request);
}
}
this.announceResponseAsync(response);
if (result === 'responded') {
this.announceResponseAsync(response);
}
}

@@ -256,2 +269,22 @@

private async sendUnmatchedRequestError(request: OngoingRequest, response: express.Response) {
let requestExplanation = await this.explainRequest(request);
if (this.debug) console.warn(`Unmatched request received: ${requestExplanation}`);
response.setHeader('Content-Type', 'text/plain');
response.writeHead(503, "Request for unmocked endpoint");
response.write("No rules were found matching this request.\n");
response.write(`This request was: ${requestExplanation}\n\n`);
if (this.rules.length > 0) {
response.write("The configured rules are:\n");
this.rules.forEach((rule) => response.write(rule.explain() + "\n"));
} else {
response.write("There are no rules configured.\n");
}
response.end(await this.suggestRule(request));
}
private async explainRequest(request: OngoingRequest): Promise<string> {

@@ -258,0 +291,0 @@ let msg = `${request.method} request to ${request.url}`;

@@ -104,8 +104,12 @@ /**

buffer: body,
get text() {
get decodedBuffer() {
return runOrUndefined(() =>
handleContentEncoding(body, headers['content-encoding'])
.toString('utf8')
);
},
get text() {
return runOrUndefined(() =>
this.decodedBuffer!.toString('utf8')
);
},
get json() {

@@ -118,3 +122,3 @@ return runOrUndefined(() =>

return runOrUndefined(() =>
completedBody.text && querystring.parse(completedBody.text)
completedBody.text ? querystring.parse(completedBody.text) : undefined
);

@@ -121,0 +125,0 @@ }

@@ -26,2 +26,3 @@ /**

const RESPONSE_COMPLETED_TOPIC = 'response-completed';
const REQUEST_ABORTED_TOPIC = 'request-aborted';

@@ -148,2 +149,8 @@ function astToObject<T>(ast: ObjectValueNode): T {

mockServer.on('abort', (request) => {
pubsub.publish(REQUEST_ABORTED_TOPIC, {
requestAborted: request
})
});
return <any> {

@@ -183,3 +190,6 @@ Query: {

subscribe: () => pubsub.asyncIterator(RESPONSE_COMPLETED_TOPIC)
}
},
requestAborted: {
subscribe: () => pubsub.asyncIterator(REQUEST_ABORTED_TOPIC)
},
},

@@ -186,0 +196,0 @@

@@ -47,3 +47,3 @@ /**

asJson: () => Promise<object>;
asFormData: () => Promise<{ [key: string]: string }>;
asFormData: () => Promise<{ [key: string]: string | string[] }>;
}

@@ -55,3 +55,3 @@

json: object | undefined;
formData: { [key: string]: string } | undefined;
formData: { [key: string]: string | string[] } | undefined;
}

@@ -58,0 +58,0 @@

@@ -11,4 +11,4 @@ /**

removeTrailingSlash: false,
removeQueryParameters: [/.*/g],
removeQueryParameters: [/.*/],
});
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc