🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

h3-proxy

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

h3-proxy - npm Package Compare versions

Comparing version

to
1.2.0

3

lib/index.cjs.js

@@ -353,6 +353,7 @@ 'use strict';

const createProxyEventHandler = (options) => {
const { target, pathFilter, pathRewrite, proxyRequestOptions } = options;
const { target, pathFilter, pathRewrite, configureProxyRequest } = options;
return (event) => {
const { req } = event.node;
const path = url.parse(req.url || '').pathname || '';
const proxyRequestOptions = typeof configureProxyRequest === 'function' ? configureProxyRequest(event) : undefined;
if (isTargetFilterPath(path, { pathFilter, req })) {

@@ -359,0 +360,0 @@ const pathRewriter = createPathRewriter(pathRewrite);

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

import { EventHandler, ProxyOptions } from 'h3';
import { EventHandler, H3Event, ProxyOptions } from 'h3';
import { IncomingMessage } from 'http';

@@ -20,2 +20,4 @@

type ConfigureProxyRequest = (event: H3Event) => ProxyOptions
interface CreateProxyEventHandlerOptions {

@@ -25,3 +27,3 @@ target: string

pathRewrite?: PathRewriterParams
proxyRequestOptions?: ProxyOptions
configureProxyRequest?: ConfigureProxyRequest
}

@@ -28,0 +30,0 @@

@@ -351,6 +351,7 @@ import isGlob from 'is-glob';

const createProxyEventHandler = (options) => {
const { target, pathFilter, pathRewrite, proxyRequestOptions } = options;
const { target, pathFilter, pathRewrite, configureProxyRequest } = options;
return (event) => {
const { req } = event.node;
const path = url.parse(req.url || '').pathname || '';
const proxyRequestOptions = typeof configureProxyRequest === 'function' ? configureProxyRequest(event) : undefined;
if (isTargetFilterPath(path, { pathFilter, req })) {

@@ -357,0 +358,0 @@ const pathRewriter = createPathRewriter(pathRewrite);

{
"name": "h3-proxy",
"version": "1.1.4",
"version": "1.2.0",
"description": "A proxy event handler for h3, using proxyRequest.",

@@ -5,0 +5,0 @@ "type": "module",

@@ -75,2 +75,3 @@ <p align="center">

| `pathRewrite` | `object/Function` | `false` | Rewrite target's url path. Object-keys will be used as RegExp to match paths. |
| `configureProxyRequest` | `Function` | `false` | Configure options of `proxyRequest`. More details see <a href="https://github.com/unjs/h3"></a> |

@@ -77,0 +78,0 @@