Skip to content

Commit

Permalink
Merge pull request #234 from appmate-io/update-type-definitions
Browse files Browse the repository at this point in the history
Update type definitions
  • Loading branch information
RafaelGSS committed Feb 19, 2022
2 parents b2faac5 + e3e5a51 commit 3179f7a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
17 changes: 9 additions & 8 deletions index.d.ts
Expand Up @@ -3,10 +3,12 @@
import {
FastifyRequest,
FastifyReply,
FastifyPlugin,
RawReplyDefaultExpression,
RawServerBase,
RequestGenericInterface
RequestGenericInterface,
HTTPMethods,
FastifyPluginAsync,
FastifyPluginCallback,
} from 'fastify';

import {
Expand Down Expand Up @@ -86,13 +88,12 @@ export interface FastifyReplyFromOptions {
http?: HttpOptions;
http2?: Http2Options | boolean;
undici?: Pool.Options;
keepAliveMsecs?: number;
maxFreeSockets?: number;
maxSockets?: number;
rejectUnauthorized?: boolean;
sessionTimeout?: number;
contentTypesToEncode?: string[];
retryMethods?: (HTTPMethods | 'TRACE')[];
maxRetriesOn503?: number;
}

declare const fastifyReplyFrom: FastifyPlugin<FastifyReplyFromOptions>
declare const fastifyReplyFrom:
| FastifyPluginCallback<FastifyReplyFromOptions>
| FastifyPluginAsync<FastifyReplyFromOptions>;
export default fastifyReplyFrom;
19 changes: 12 additions & 7 deletions test/index.test-d.ts
Expand Up @@ -37,15 +37,13 @@ const fullOptions: FastifyReplyFromOptions = {
},
cacheURLs: 100,
disableCache: false,
keepAliveMsecs: 60 * 1000,
maxFreeSockets: 2048,
maxSockets: 2048,
rejectUnauthorized: true,
undici: {
connections: 100,
pipelining: 10
},
contentTypesToEncode: ['application/x-www-form-urlencoded']
contentTypesToEncode: ['application/x-www-form-urlencoded'],
retryMethods: ['GET', 'HEAD', 'OPTIONS', 'TRACE'],
maxRetriesOn503: 10,
};
tap.autoend(false);

Expand Down Expand Up @@ -109,9 +107,16 @@ async function main() {
const port = (target.server.address() as AddressInfo).port;
instance.register(replyFrom, {
base: `http://localhost:${port}`,
http2: true,
rejectUnauthorized: false
http2: {
sessionOptions: {
rejectUnauthorized: false,
},
},
});
instance.register(replyFrom, {
base: `http://localhost:${port}`,
http2: true,
});
await instance.listen(0);

const undiciInstance = fastify();
Expand Down

0 comments on commit 3179f7a

Please sign in to comment.