@fastify/reply-from 8.2.0 → 8.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,3 +15,4 @@ jobs:
15
15
  uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3
16
16
  with:
17
17
  license-check: true
18
+ lint: true
package/.taprc CHANGED
@@ -3,3 +3,6 @@ jsx: false
3
3
  flow: false
4
4
  coverage: true
5
5
  check-coverage: false
6
+
7
+ files:
8
+ - test/**/*.js
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @fastify/reply-from
2
2
 
3
- ![CI](https://github.com/fastify/fastify-reply-from/workflows/CI/badge.svg)
3
+ [![CI](https://github.com/fastify/reply-fro/workflows/CI/badge.svg)](https://github.com/fastify/reply-fro/actions/workflows/ci.yml)
4
4
  [![NPM version](https://img.shields.io/npm/v/@fastify/reply-from.svg?style=flat)](https://www.npmjs.com/package/@fastify/reply-from)
5
5
  [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
6
6
 
@@ -115,7 +115,7 @@ proxy.register(require('@fastify/reply-from'), {
115
115
 
116
116
  #### `http`
117
117
 
118
- Set the `http` option to `true` or to an Object to use
118
+ Set the `http` option to an Object to use
119
119
  Node's [`http.request`](https://nodejs.org/api/http.html#http_http_request_options_callback)
120
120
  will be used if you do not enable [`http2`](#http2). To customize the `request`,
121
121
  you can pass in [`agentOptions`](https://nodejs.org/api/http.html#http_new_agent_options) and
@@ -15,7 +15,7 @@ const proxy = Fastify({
15
15
  })
16
16
 
17
17
  // proxy.register(require('fastify-reply-from'), {
18
- proxy.register(require('.'), {
18
+ proxy.register(require('..'), {
19
19
  base: 'http://localhost:3001/'
20
20
  })
21
21
 
package/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const fp = require('fastify-plugin')
4
4
  const lru = require('tiny-lru')
5
- const querystring = require('querystring')
5
+ const querystring = require('fast-querystring')
6
6
  const Stream = require('stream')
7
7
  const buildRequest = require('./lib/request')
8
8
  const {
package/lib/request.js CHANGED
@@ -1,5 +1,4 @@
1
1
  'use strict'
2
- const semver = require('semver')
3
2
  const http = require('http')
4
3
  const https = require('https')
5
4
  const querystring = require('querystring')
@@ -48,9 +47,6 @@ function buildRequest (opts) {
48
47
  let agents
49
48
 
50
49
  if (isHttp2) {
51
- if (semver.lt(process.version, '9.0.0')) {
52
- throw new Error('Http2 support requires Node version >= 9.0.0')
53
- }
54
50
  if (!opts.base) throw new Error('Option base is required when http2 is true')
55
51
  if (opts.base.startsWith('unix+')) {
56
52
  throw new Error('Unix socket destination is not supported when http2 is true')
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@fastify/reply-from",
3
- "version": "8.2.0",
3
+ "version": "8.3.0",
4
4
  "description": "forward your HTTP request to another server, for fastify",
5
5
  "main": "index.js",
6
- "types": "index.d.ts",
6
+ "types": "types/index.d.ts",
7
7
  "scripts": {
8
- "coverage": "tap -j8 test/*.js --cov --coverage-report=html",
8
+ "lint": "standard | snazzy",
9
9
  "lint:fix": "standard --fix",
10
- "test": "standard | snazzy && tap test/*.js && npm run typescript",
11
- "test:ci": "standard | snazzy && tap test/*.js --coverage-report=lcovonly && npm run typescript",
12
- "typescript": "tsd"
10
+ "test": "npm run test:unit && npm run test:typescript",
11
+ "test:unit": "tap",
12
+ "test:typescript": "tsd"
13
13
  },
14
14
  "repository": {
15
15
  "type": "git",
@@ -46,21 +46,21 @@
46
46
  "split2": "^4.1.0",
47
47
  "standard": "^17.0.0",
48
48
  "tap": "^16.2.0",
49
- "tsd": "^0.22.0",
50
- "typescript": "^4.7.3"
49
+ "tsd": "^0.23.0"
51
50
  },
52
51
  "dependencies": {
53
52
  "@fastify/error": "^3.0.0",
54
53
  "end-of-stream": "^1.4.4",
54
+ "fast-querystring": "^1.0.0",
55
55
  "fastify-plugin": "^4.0.0",
56
56
  "pump": "^3.0.0",
57
- "semver": "^7.3.7",
58
57
  "tiny-lru": "^8.0.2",
59
58
  "undici": "^5.5.1"
60
59
  },
61
- "tsd": {
62
- "directory": "test"
63
- },
60
+ "pre-commit": [
61
+ "lint",
62
+ "test"
63
+ ],
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  }
@@ -7,7 +7,6 @@ import {
7
7
  RawServerBase,
8
8
  RequestGenericInterface,
9
9
  HTTPMethods,
10
- FastifyPluginAsync,
11
10
  FastifyPluginCallback,
12
11
  } from 'fastify';
13
12
 
@@ -85,7 +84,7 @@ export interface FastifyReplyFromOptions {
85
84
  base?: string;
86
85
  cacheURLs?: number;
87
86
  disableCache?: boolean;
88
- http?: HttpOptions | boolean;
87
+ http?: HttpOptions;
89
88
  http2?: Http2Options | boolean;
90
89
  undici?: Pool.Options;
91
90
  contentTypesToEncode?: string[];
@@ -94,7 +93,5 @@ export interface FastifyReplyFromOptions {
94
93
  disableRequestLogging?: boolean;
95
94
  }
96
95
 
97
- declare const fastifyReplyFrom:
98
- | FastifyPluginCallback<FastifyReplyFromOptions>
99
- | FastifyPluginAsync<FastifyReplyFromOptions>;
96
+ declare const fastifyReplyFrom: FastifyPluginCallback<FastifyReplyFromOptions>;
100
97
  export default fastifyReplyFrom;
@@ -1,4 +1,4 @@
1
- import replyFrom, { FastifyReplyFromOptions } from "../";
1
+ import replyFrom, { FastifyReplyFromOptions } from "..";
2
2
  import fastify, {FastifyReply, RawServerBase} from "fastify";
3
3
  import { AddressInfo } from "net";
4
4
  import { IncomingHttpHeaders } from "http2";