mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-26 06:05:54 +08:00
Fixed export
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
///<reference path="mitm.d.ts"/>
|
||||
|
||||
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 => {
|
||||
});
|
||||
|
||||
9
mitm/mitm.d.ts
vendored
9
mitm/mitm.d.ts
vendored
@@ -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 = _;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user