Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"micromatch": "^4.0.8"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
"node": "^14.18.0 || ^16.10.0 || >=18.0.0"
},
"commitlint": {
"extends": [
Expand Down
2 changes: 1 addition & 1 deletion src/factory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type * as http from 'http';
import type * as http from 'node:http';

import { HttpProxyMiddleware } from './http-proxy-middleware';
import type { NextFunction, Options, RequestHandler } from './types';
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/fix-request-body.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type * as http from 'http';
import * as querystring from 'querystring';
import type * as http from 'node:http';
import * as querystring from 'node:querystring';

export type BodyParserLikeRequest = http.IncomingMessage & { body?: any };

Expand Down
4 changes: 2 additions & 2 deletions src/handlers/response-interceptor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type * as http from 'http';
import * as zlib from 'zlib';
import type * as http from 'node:http';
import * as zlib from 'node:zlib';

import { Debug } from '../debug';
import { getFunctionName } from '../utils/function';
Expand Down
7 changes: 4 additions & 3 deletions src/http-proxy-middleware.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type * as http from 'http';
import type * as http from 'node:http';
import type * as https from 'node:https';
import type * as net from 'node:net';

import * as httpProxy from 'http-proxy';
import type * as https from 'https';
import type * as net from 'net';

import { verifyConfig } from './configuration';
import { Debug as debug } from './debug';
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/create-proxy-middleware.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type * as http from 'http';
import type * as http from 'node:http';

import { Debug } from '../debug';
import { createProxyMiddleware } from '../factory';
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/options-adapter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as url from 'url';
import * as url from 'node:url';

import { Debug } from '../debug';
import { getLogger } from '../logger';
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type * as http from 'http';
import type * as http from 'node:http';

import { Options } from '../types';

Expand Down
5 changes: 3 additions & 2 deletions src/path-filter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type * as http from 'http';
import type * as http from 'node:http';
import * as url from 'node:url';

import * as isGlob from 'is-glob';
import * as micromatch from 'micromatch';
import * as url from 'url';

import { ERRORS } from './errors';
import type { Filter } from './types';
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/default/error-response-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type * as http from 'http';
import type { Socket } from 'net';
import type * as http from 'node:http';
import type { Socket } from 'node:net';

import { getStatusCode } from '../../status-code';
import { Plugin } from '../../types';
Expand Down
3 changes: 1 addition & 2 deletions src/plugins/default/logger-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { IncomingMessage } from 'node:http';

import { URL } from 'url';
import { URL } from 'node:url';

import { getLogger } from '../../logger';
import { Plugin } from '../../types';
Expand Down
5 changes: 3 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
* Based on definition by DefinitelyTyped:
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/6f529c6c67a447190f86bfbf894d1061e41e07b7/types/http-proxy-middleware/index.d.ts
*/
import type * as http from 'http';
import type * as http from 'node:http';
import type * as net from 'node:net';

import type * as httpProxy from 'http-proxy';
import type * as net from 'net';

export type NextFunction<T = (err?: any) => void> = T;

Expand Down
3 changes: 2 additions & 1 deletion test/e2e/http-proxy-middleware.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type * as http from 'node:http';

import * as bodyParser from 'body-parser';
import type * as express from 'express';
import type * as http from 'http';
import { CompletedRequest, Mockttp, getLocal } from 'mockttp';
import * as request from 'supertest';

Expand Down
3 changes: 2 additions & 1 deletion test/e2e/http-server.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as http from 'http';
import * as http from 'node:http';

import * as request from 'supertest';

import { createProxyMiddleware } from './test-kit';
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/test-kit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as express from 'express';
import { Express, RequestHandler } from 'express';
import type { Express, RequestHandler } from 'express';

export { createProxyMiddleware, responseInterceptor, fixRequestBody } from '../../src/index';

Expand Down
3 changes: 2 additions & 1 deletion test/e2e/websocket.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as http from 'node:http';

import * as getPort from 'get-port';
import * as http from 'http';
import { WebSocket, WebSocketServer } from 'ws';

import type { RequestHandler } from '../../src/types';
Expand Down
3 changes: 2 additions & 1 deletion test/types.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-expressions */
import * as http from 'node:http';

import * as express from 'express';
import * as http from 'http';

import { fixRequestBody, createProxyMiddleware as middleware, responseInterceptor } from '../src';
import type { Options, RequestHandler } from '../src/types';
Expand Down
6 changes: 3 additions & 3 deletions test/unit/fix-request-body.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ClientRequest, IncomingMessage, ServerResponse } from 'http';
import { Socket } from 'net';
import * as querystring from 'querystring';
import { ClientRequest, IncomingMessage, ServerResponse } from 'node:http';
import { Socket } from 'node:net';
import * as querystring from 'node:querystring';

import { BodyParserLikeRequest, fixRequestBody } from '../../src/handlers/fix-request-body';

Expand Down
2 changes: 1 addition & 1 deletion test/unit/path-filter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type * as http from 'http';
import type * as http from 'node:http';

import { matchPathFilter } from '../../src/path-filter';

Expand Down
4 changes: 2 additions & 2 deletions test/unit/response-interceptor.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IncomingMessage, ServerResponse } from 'http';
import { Socket } from 'net';
import { IncomingMessage, ServerResponse } from 'node:http';
import { Socket } from 'node:net';

import { responseInterceptor } from '../../src/handlers/response-interceptor';

Expand Down