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

@fastify/reply-from

Package Overview
Dependencies
Maintainers
19
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/reply-from - npm Package Compare versions

Comparing version 9.3.0 to 9.4.0

test/method.test.js

9

index.js

@@ -55,2 +55,3 @@ 'use strict'

const req = this.request.raw
const method = opts.method || req.method
const onResponse = opts.onResponse

@@ -131,3 +132,3 @@ const rewriteHeaders = opts.rewriteHeaders || headersNoOp

// discussion: https://github.com/fastify/fastify/issues/953
if (req.method === 'GET' || req.method === 'HEAD') {
if (method === 'GET' || method === 'HEAD') {
// body will be populated here only if opts.body is passed.

@@ -137,3 +138,3 @@ // if we are doing that with a GET or HEAD request is a programmer error

if (body) {
throw new Error(`Rewriting the body when doing a ${req.method} is not allowed`)
throw new Error(`Rewriting the body when doing a ${method} is not allowed`)
}

@@ -147,3 +148,3 @@ }

let requestImpl
if (retryMethods.has(req.method) && !contentLength) {
if (retryMethods.has(method) && !contentLength) {
requestImpl = createRequestRetry(request, this, retriesCount, retryOnError, maxRetriesOn503)

@@ -154,3 +155,3 @@ } else {

requestImpl({ method: req.method, url, qs, headers: requestHeaders, body }, (err, res) => {
requestImpl({ method, url, qs, headers: requestHeaders, body }, (err, res) => {
if (err) {

@@ -157,0 +158,0 @@ this.request.log.warn(err, 'response errored')

{
"name": "@fastify/reply-from",
"version": "9.3.0",
"version": "9.4.0",
"description": "forward your HTTP request to another server, for fastify",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -391,2 +391,6 @@ # @fastify/reply-from

#### `method`
Replaces the original request method with what is specified.
#### `retriesCount`

@@ -393,0 +397,0 @@

@@ -70,2 +70,3 @@ /// <reference types="node" />

) => string;
method?: HTTPMethods;
}

@@ -72,0 +73,0 @@

@@ -93,2 +93,3 @@ import replyFrom, { FastifyReplyFromOptions } from "..";

reply.from("/", {
method: "POST",
rewriteHeaders(headers, req) {

@@ -95,0 +96,0 @@ return headers;

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