Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastify-http-proxy

Package Overview
Dependencies
Maintainers
8
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-http-proxy - npm Package Compare versions

Comparing version 3.2.0 to 4.0.0

.dependabot/config.yml

70

index.d.ts
/// <reference types="node" />
import {
FastifyRequest,
Plugin,
DefaultQuery,
DefaultParams,
DefaultHeaders,
RawServerBase,
FastifyPlugin,
FastifyError,
FastifyReply
} from "fastify";
import { Server, IncomingMessage, ServerResponse } from "http";
import { Http2ServerRequest, Http2ServerResponse } from "http2";
type HttpRequest = IncomingMessage | Http2ServerRequest;
type HttpResponse = ServerResponse | Http2ServerResponse;
export interface FastifyHttpProxyOptions {
upstream: string;
prefix?: string;
rewritePrefix?: string;
http2?: boolean;
proxyPayloads?: boolean;
preHandler?: (
request: FastifyRequest<RawServerBase>,
reply: FastifyReply<RawServerBase>,
next: (err?: FastifyError | undefined) => void
) => void;
beforeHandler?: (
request: FastifyRequest<RawServerBase>,
reply: FastifyReply<RawServerBase>,
next: (err?: FastifyError | undefined) => void
) => void;
config?: Object;
replyOptions?: Object;
}
declare const fastifyHttpProxy: Plugin<
Server,
IncomingMessage,
ServerResponse,
{
upstream: string;
prefix?: string;
rewritePrefix?: string;
http2?: boolean;
proxyPayloads?: boolean;
preHandler?: (
request: FastifyRequest<
HttpRequest,
DefaultQuery,
DefaultParams,
DefaultHeaders,
any
>,
reply: FastifyReply<HttpResponse>,
next: (err?: FastifyError | undefined) => void
) => void;
beforeHandler?: (
request: FastifyRequest<
HttpRequest,
DefaultQuery,
DefaultParams,
DefaultHeaders,
any
>,
reply: FastifyReply<HttpResponse>,
next: (err?: FastifyError | undefined) => void
) => void;
config?: Object;
replyOptions?: Object;
}
>;
export = fastifyHttpProxy;
declare const fastifyHttpProxy: FastifyPlugin<FastifyHttpProxyOptions>;
export default fastifyHttpProxy;

@@ -45,4 +45,4 @@ 'use strict'

function bodyParser (req, done) {
done(null, req)
function bodyParser (req, payload, done) {
done(null, payload)
}

@@ -83,3 +83,3 @@

function handler (request, reply) {
var dest = request.req.url
var dest = request.raw.url
dest = dest.replace(this.prefix, rewritePrefix)

@@ -86,0 +86,0 @@ reply.from(dest || '/', replyOpts)

{
"name": "fastify-http-proxy",
"version": "3.2.0",
"version": "4.0.0",
"description": "proxy http requests, for Fastify",

@@ -9,3 +9,3 @@ "main": "index.js",

"lint:typescript": "standard --fix --parser @typescript-eslint/parser --plugin typescript test/types/*.ts",
"typescript": "tsc --project ./test/types/tsconfig.json"
"typescript": "tsd"
},

@@ -28,9 +28,9 @@ "repository": {

"devDependencies": {
"@types/node": "^13.1.0",
"@typescript-eslint/parser": "^2.0.0",
"@types/node": "^14.0.13",
"@typescript-eslint/parser": "^3.3.0",
"eslint-plugin-typescript": "^0.14.0",
"express": "^4.16.4",
"express-http-proxy": "^1.5.0",
"fastify": "^2.0.0",
"got": "^10.6.0",
"fastify": "^3.0.0-alpha.1",
"got": "^11.3.0",
"http-errors": "^1.7.1",

@@ -40,13 +40,17 @@ "http-proxy": "^1.17.0",

"pre-commit": "^1.2.2",
"simple-get": "^3.0.3",
"simple-get": "^4.0.0",
"snazzy": "^8.0.0",
"standard": "^14.0.2",
"tap": "^14.0.0",
"tsd": "^0.11.0",
"typescript": "^3.4.5"
},
"dependencies": {
"fastify-reply-from": "^2.0.0",
"fastify-websocket": "^1.1.2",
"ws": "^7.2.5"
"ws": "^7.2.5",
"fastify-reply-from": "^3.1.0"
},
"tsd": {
"directory": "test"
}
}
# fastify-http-proxy
[![Greenkeeper badge](https://badges.greenkeeper.io/fastify/fastify-http-proxy.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/fastify/fastify-http-proxy.svg?branch=master)](https://travis-ci.org/fastify/fastify-http-proxy)

@@ -6,0 +4,0 @@

@@ -175,3 +175,15 @@ 'use strict'

async preHandler (request, reply) {
t.deepEqual(reply.context.config, { foo: 'bar', url: '/*' })
t.deepEqual(reply.context.config, {
foo: 'bar',
url: '/*',
// GET is not there because of the nonWsMethods.
method: [
'DELETE',
'HEAD',
'PATCH',
'POST',
'PUT',
'OPTIONS'
]
})
throw new Unauthorized()

@@ -178,0 +190,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc