File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
test/integration/proxying Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -778,6 +778,25 @@ nodeOnly(() => {
778778 expect ( response ) . to . equal ( 'all good' ) ;
779779 } ) ;
780780
781+ it ( "should be able to examine the request in beforeResponse" , async ( ) => {
782+ await remoteServer . forGet ( '/' ) . thenCallback ( ( ) => ( {
783+ status : 500 ,
784+ headers : {
785+ 'UPPERCASE-HEADER' : 'VALUE'
786+ }
787+ } ) ) ;
788+
789+ await server . forGet ( remoteServer . urlFor ( "/" ) ) . thenPassThrough ( {
790+ beforeResponse : ( _res , req ) => {
791+ expect ( req . url ) . to . equal ( remoteServer . urlFor ( '/' ) ) ;
792+ return { status : 200 , body : 'got correct req url' } ;
793+ }
794+ } ) ;
795+
796+ let response = await request . get ( remoteServer . urlFor ( "/" ) ) ;
797+ expect ( response ) . to . equal ( 'got correct req url' ) ;
798+ } ) ;
799+
781800 it ( "should be able to rewrite a response's status" , async ( ) => {
782801 await remoteServer . forGet ( '/' ) . thenReply ( 404 ) ;
783802 await server . forGet ( remoteServer . urlFor ( "/" ) ) . thenPassThrough ( {
You can’t perform that action at this time.
0 commit comments