@fastify/reply-from 12.0.1 → 12.0.2

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.
@@ -9,5 +9,5 @@ updates:
9
9
  - package-ecosystem: "npm"
10
10
  directory: "/"
11
11
  schedule:
12
- interval: "weekly"
12
+ interval: "monthly"
13
13
  open-pull-requests-limit: 10
@@ -4,7 +4,6 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
- - master
8
7
  - next
9
8
  - 'v*'
10
9
  paths-ignore:
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @fastify/reply-from
2
2
 
3
- [![CI](https://github.com/fastify/fastify-reply-from/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/fastify/fastify-reply-from/actions/workflows/ci.yml)
3
+ [![CI](https://github.com/fastify/fastify-reply-from/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fastify/fastify-reply-from/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
  [![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastify/reply-from",
3
- "version": "12.0.1",
3
+ "version": "12.0.2",
4
4
  "description": "forward your HTTP request to another server, for fastify",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
@@ -70,7 +70,7 @@
70
70
  "got": "^11.8.6",
71
71
  "h2url": "^0.2.0",
72
72
  "neostandard": "^0.12.0",
73
- "nock": "^13.5.4",
73
+ "nock": "^14.0.0",
74
74
  "proxy": "^2.1.1",
75
75
  "proxyquire": "^2.1.3",
76
76
  "simple-get": "^4.0.1",
package/types/index.d.ts CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  AgentOptions as SecureAgentOptions,
29
29
  RequestOptions as SecureRequestOptions
30
30
  } from 'https'
31
- import { Pool, ProxyAgent } from 'undici'
31
+ import { Pool, ProxyAgent, Dispatcher } from 'undici'
32
32
 
33
33
  declare module 'fastify' {
34
34
  interface FastifyReply {
@@ -104,7 +104,7 @@ declare namespace fastifyReplyFrom {
104
104
  disableCache?: boolean;
105
105
  http?: HttpOptions;
106
106
  http2?: Http2Options | boolean;
107
- undici?: Pool.Options & { proxy?: string | URL | ProxyAgent.Options };
107
+ undici?: Pool.Options & { proxy?: string | URL | ProxyAgent.Options } | { request: Dispatcher['request'] };
108
108
  contentTypesToEncode?: string[];
109
109
  retryMethods?: (HTTPMethods | 'TRACE')[];
110
110
  maxRetriesOn503?: number;
@@ -4,6 +4,7 @@ import { IncomingHttpHeaders } from 'http2'
4
4
  import * as https from 'node:https'
5
5
  import { AddressInfo } from 'net'
6
6
  import { expectType } from 'tsd'
7
+ import { Agent, Client, Dispatcher, Pool } from 'undici'
7
8
  import replyFrom, { FastifyReplyFromOptions } from '..'
8
9
  // @ts-ignore
9
10
  import tap from 'tap'
@@ -158,6 +159,34 @@ async function main () {
158
159
  })
159
160
  await undiciInstance.ready()
160
161
 
162
+ const undiciInstanceAgent = fastify()
163
+ undiciInstance.register(replyFrom, {
164
+ base: 'http://example2.com',
165
+ undici: new Agent()
166
+ })
167
+ await undiciInstanceAgent.ready()
168
+
169
+ const undiciInstancePool = fastify()
170
+ undiciInstance.register(replyFrom, {
171
+ base: 'http://example2.com',
172
+ undici: new Pool('http://example2.com')
173
+ })
174
+ await undiciInstancePool.ready()
175
+
176
+ const undiciInstanceClient = fastify()
177
+ undiciInstance.register(replyFrom, {
178
+ base: 'http://example2.com',
179
+ undici: new Client('http://example2.com')
180
+ })
181
+ await undiciInstanceClient.ready()
182
+
183
+ const undiciInstanceDispatcher = fastify()
184
+ undiciInstance.register(replyFrom, {
185
+ base: 'http://example2.com',
186
+ undici: new Dispatcher()
187
+ })
188
+ await undiciInstanceDispatcher.ready()
189
+
161
190
  tap.pass('done')
162
191
  tap.end()
163
192
  }