From e41ddf9b61accea03e6cb6dc2862b9fdcb9350ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20S=C3=A1nchez?= Date: Tue, 30 Aug 2016 17:41:58 -0600 Subject: [PATCH] Fixed export --- mitm/mitm-tests.ts | 12 +++++------- mitm/mitm.d.ts | 9 +++++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/mitm/mitm-tests.ts b/mitm/mitm-tests.ts index 90570ef377..00abe30b1a 100644 --- a/mitm/mitm-tests.ts +++ b/mitm/mitm-tests.ts @@ -1,18 +1,16 @@ /// -import Mitm, {BypassableSocket, SocketOptions} from 'mitm'; -import {Socket} from 'net'; -import {IncomingMessage, ServerResponse} from 'http'; +import Mitm = require('mitm'); const mitm = Mitm(); mitm.disable(); -mitm.on('connect', (socket: BypassableSocket, opts: SocketOptions): void => { - socket.bypass(); +mitm.on('connect', (bypassableSocket, opts): void => { + bypassableSocket.bypass(); }); -mitm.on('connection', (socket: Socket, opts: SocketOptions): void => { +mitm.on('connection', (socket, opts): void => { }); -mitm.on('request', (request: IncomingMessage, response: ServerResponse): void => { +mitm.on('request', (request, response): void => { }); diff --git a/mitm/mitm.d.ts b/mitm/mitm.d.ts index b9cabb633c..2c5f03f8bc 100644 --- a/mitm/mitm.d.ts +++ b/mitm/mitm.d.ts @@ -9,7 +9,7 @@ declare module 'mitm' { import * as http from 'http'; import * as net from 'net'; - export interface SocketOptions { + interface SocketOptions { port: number; host?: string; localAddress?: string; @@ -18,7 +18,7 @@ declare module 'mitm' { allowHalfOpen?: boolean; } - export interface BypassableSocket extends net.Socket { + interface BypassableSocket extends net.Socket { bypass(): void } @@ -32,7 +32,7 @@ declare module 'mitm' { type Callback = SocketConnectCallback | SocketConnectionCallback | HttpCallback; - export interface Mitm { + interface Mitm { disable(): void; on(event: Event, callback: Callback): void; on(event: 'connect', callback: SocketConnectCallback): void; @@ -40,5 +40,6 @@ declare module 'mitm' { on(event: 'request', callback: HttpCallback): void; } - export default function (): Mitm; + function _(): Mitm; + export = _; }