@refactorjs/http-proxy
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -8,3 +8,3 @@ import * as url from 'url'; | ||
import * as buffer from 'buffer'; | ||
import * as followRedirects from 'follow-redirects'; | ||
import { FollowOptions } from 'follow-redirects'; | ||
import { EventEmitter } from 'events'; | ||
@@ -22,3 +22,3 @@ | ||
*/ | ||
web: Passthrough; | ||
web: WebPassthrough; | ||
/** | ||
@@ -31,5 +31,5 @@ * Used for proxying regular HTTP(S) requests | ||
*/ | ||
ws: Passthrough; | ||
webPasses: Passthrough[]; | ||
wsPasses: Passthrough[]; | ||
ws: WsPassthrough; | ||
webPasses: WebPassthrough[]; | ||
wsPasses: WsPassthrough[]; | ||
/** | ||
@@ -51,4 +51,4 @@ * Creates the proxy server with specified options. | ||
close(callback?: () => void): void; | ||
before(type: 'web' | 'ws', passName: string, callback: Passthrough): void; | ||
after(type: 'web' | 'ws', passName: string, callback: Passthrough): void; | ||
before(type: 'web' | 'ws', passName: string, callback: WebPassthrough & WsPassthrough): void; | ||
after(type: 'web' | 'ws', passName: string, callback: WebPassthrough & WsPassthrough): void; | ||
} | ||
@@ -75,7 +75,7 @@ declare const createProxyServer: (options?: Server.ServerOptions) => ProxyServer; | ||
servername?: string; | ||
searchParams?: string | url.URLSearchParams; | ||
searchParams?: url.URLSearchParams; | ||
pathname?: string; | ||
path?: string; | ||
} | ||
interface OutgoingOptions extends ProxyTargetDetailed, followRedirects.FollowOptions<Server.followOptions> { | ||
interface OutgoingOptions extends ProxyTargetDetailed, Server.ServerOptions { | ||
localAddress?: string; | ||
@@ -86,12 +86,21 @@ headers?: Server.ServerOptions['headers']; | ||
rejectUnauthorized?: boolean; | ||
maxRedirects?: FollowOptions<any>['maxRedirects']; | ||
maxBodyLength?: FollowOptions<any>['maxBodyLength']; | ||
agents?: FollowOptions<any>['agents']; | ||
beforeRedirect?: FollowOptions<any>['beforeRedirect']; | ||
trackRedirects?: FollowOptions<any>['trackRedirects']; | ||
} | ||
interface Passthrough { | ||
interface WebPassthrough { | ||
(req: http.IncomingMessage, res: http.ServerResponse): boolean | void; | ||
(req: http.IncomingMessage, res: http.ServerResponse | net.Socket, head?: buffer.Buffer): boolean | void; | ||
(req: http.IncomingMessage, res: http.ServerResponse, options: Server.ServerOptions, head?: buffer.Buffer, server?: ProxyServer, callback?: (err?: Error, req?: http.IncomingMessage, res?: http.ServerResponse, url?: Server.ServerOptions['target']) => void): boolean | void; | ||
(req: http.IncomingMessage, res: http.ServerResponse, options: Server.ServerOptions): boolean | void; | ||
(req: http.IncomingMessage, res: http.ServerResponse, options: Server.ServerOptions, server?: ProxyServer, callback?: (err?: any, req?: http.IncomingMessage, res?: http.ServerResponse, url?: Server.ServerOptions['target']) => void): boolean | void; | ||
} | ||
interface WsPassthrough { | ||
(req: http.IncomingMessage, socket: net.Socket): boolean | void; | ||
(req: http.IncomingMessage, socket: net.Socket, head?: buffer.Buffer): boolean | void; | ||
(req: http.IncomingMessage, socket: net.Socket, options: Server.ServerOptions, head?: buffer.Buffer, server?: ProxyServer, callback?: (err: any, req: http.IncomingMessage, socket: net.Socket) => void): boolean | void; | ||
} | ||
declare namespace Server { | ||
type ProxyTarget = ProxyTargetUrl | url.URL & ProxyTargetDetailed; | ||
type ProxyTargetUrl = Partial<url.URL & ProxyTargetDetailed>; | ||
type followOptions = {}; | ||
interface ServerOptions { | ||
@@ -151,3 +160,3 @@ /** URL string to be parsed with the url module. */ | ||
/** Specify whether you want to follow redirects. Default: false */ | ||
followRedirects?: followRedirects.FollowOptions<followOptions>; | ||
followRedirects?: FollowOptions<any> | false; | ||
/** if set to true the web passes will be run even if `selfHandleResponse` is also set to true. */ | ||
@@ -175,2 +184,2 @@ forcePasses?: boolean; | ||
export { OutgoingOptions, Passthrough, ProxyServer, ProxyTargetDetailed, Server, createProxy, createProxyServer, createServer }; | ||
export { OutgoingOptions, ProxyServer, ProxyTargetDetailed, Server, WebPassthrough, WsPassthrough, createProxy, createProxyServer, createServer }; |
{ | ||
"name": "@refactorjs/http-proxy", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "http-proxy alternative", | ||
@@ -26,7 +26,6 @@ "repository": { | ||
"build": "unbuild", | ||
"release": "standard-version && git push --follow-tags && npm publish", | ||
"test": "vitest run" | ||
}, | ||
"dependencies": { | ||
"follow-redirects": "^1.15.1", | ||
"follow-redirects": "^1.15.2", | ||
"requires-port": "^1.0.0" | ||
@@ -36,3 +35,3 @@ }, | ||
"@types/follow-redirects": "^1.14.1", | ||
"@types/node": "^18.7.6", | ||
"@types/node": "^18.7.18", | ||
"@types/requires-port": "^1.0.0", | ||
@@ -43,9 +42,8 @@ "async": "^3.2.4", | ||
"semver": "^7.3.7", | ||
"socket.io": "^4.5.1", | ||
"socket.io-client": "^4.5.1", | ||
"socket.io": "^4.5.2", | ||
"socket.io-client": "^4.5.2", | ||
"sse": "0.0.8", | ||
"standard-version": "^9.5.0", | ||
"typescript": "^4.7.4", | ||
"unbuild": "^0.8.8", | ||
"vitest": "^0.22.1", | ||
"typescript": "^4.8.3", | ||
"unbuild": "^0.8.11", | ||
"vitest": "^0.23.2", | ||
"ws": "^8.8.1" | ||
@@ -52,0 +50,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64723
14
1400
6
Updatedfollow-redirects@^1.15.2