@@ -4,15 +4,15 @@ import fastify, {
4
4
type FastifyRequest ,
5
5
type RawServerBase ,
6
6
type RequestGenericInterface ,
7
- } from 'fastify' ;
8
- import { expectError , expectType } from 'tsd' ;
9
- import fastifyHttpProxy from '..' ;
7
+ } from 'fastify'
8
+ import { expectError , expectType } from 'tsd'
9
+ import fastifyHttpProxy from '..'
10
10
11
- const app = fastify ( ) ;
11
+ const app = fastify ( )
12
12
13
13
app . register ( fastifyHttpProxy , {
14
14
upstream : 'http://origin.asd' ,
15
- } ) ;
15
+ } )
16
16
17
17
app . register ( fastifyHttpProxy , {
18
18
upstream : 'http://origin.asd' ,
@@ -23,16 +23,16 @@ app.register(fastifyHttpProxy, {
23
23
replyOptions : { contentType : 'application/json' } ,
24
24
httpMethods : [ 'DELETE' , 'GET' , 'HEAD' , 'PATCH' , 'POST' , 'PUT' , 'OPTIONS' ] ,
25
25
preHandler : ( request , reply ) => {
26
- expectType < RawRequestDefaultExpression > ( request . raw ) ;
27
- expectType < RawReplyDefaultExpression > ( reply . raw ) ;
26
+ expectType < RawRequestDefaultExpression > ( request . raw )
27
+ expectType < RawReplyDefaultExpression > ( reply . raw )
28
28
} ,
29
29
beforeHandler : ( request , reply ) => {
30
- expectType < RawRequestDefaultExpression > ( request . raw ) ;
31
- expectType < RawReplyDefaultExpression > ( reply . raw ) ;
30
+ expectType < RawRequestDefaultExpression > ( request . raw )
31
+ expectType < RawReplyDefaultExpression > ( reply . raw )
32
32
} ,
33
33
preValidation : ( request , reply ) => {
34
- expectType < RawRequestDefaultExpression > ( request . raw ) ;
35
- expectType < RawReplyDefaultExpression > ( reply . raw ) ;
34
+ expectType < RawRequestDefaultExpression > ( request . raw )
35
+ expectType < RawReplyDefaultExpression > ( reply . raw )
36
36
} ,
37
37
base : 'whatever' ,
38
38
cacheURLs : 10 ,
@@ -56,41 +56,41 @@ app.register(fastifyHttpProxy, {
56
56
websocket : true ,
57
57
wsUpstream : 'ws://origin.asd/connection' ,
58
58
wsClientOptions : {
59
- queryString ( search , reqUrl , request ) {
60
- expectType < string | undefined > ( search ) ;
61
- expectType < string > ( reqUrl ) ;
62
- expectType < FastifyRequest < RequestGenericInterface , RawServerBase > > ( request ) ;
63
- return '' ;
59
+ queryString ( search , reqUrl , request ) {
60
+ expectType < string | undefined > ( search )
61
+ expectType < string > ( reqUrl )
62
+ expectType < FastifyRequest < RequestGenericInterface , RawServerBase > > ( request )
63
+ return ''
64
64
} ,
65
65
} ,
66
66
internalRewriteLocationHeader : true ,
67
- } ) ;
67
+ } )
68
68
69
69
expectError (
70
70
app . register ( fastifyHttpProxy , {
71
71
thisOptionDoesNotExist : 'triggers a typescript error' ,
72
72
} )
73
- ) ;
73
+ )
74
74
75
75
expectError (
76
76
app . register ( fastifyHttpProxy , {
77
77
upstream : 'http://origin.asd' ,
78
78
wsUpstream : 'ws://origin.asd' ,
79
79
} )
80
- ) ;
80
+ )
81
81
82
82
expectError (
83
83
app . register ( fastifyHttpProxy , {
84
84
upstream : 'http://origin.asd' ,
85
85
websocket : false ,
86
86
wsUpstream : 'asdf' ,
87
87
} )
88
- ) ;
88
+ )
89
89
90
90
expectError (
91
91
app . register ( fastifyHttpProxy , {
92
92
upstream : 'http://origin.asd' ,
93
93
websocket : false ,
94
94
internalRewriteLocationHeader : 'NON_BOOLEAN_VALUE'
95
95
} )
96
- ) ;
96
+ )
0 commit comments