@@ -19,7 +19,7 @@ describe("express with google upstream and botli decompress", function () {
1919 env = process . env ;
2020 let app = require ( "./app" ) ;
2121 app . setup ( {
22- UPSTREAM : "www.google.co.uk" ,
22+ UPSTREAM : "https:// www.google.co.uk" ,
2323 LOG_LEVEL : "DEBUG" ,
2424 UNBOTLI : "true"
2525 } ) ;
@@ -45,6 +45,19 @@ describe("express with google upstream and botli decompress", function () {
4545 } ) ;
4646
4747 it ( "returns good content for / with accept-encoding and User-Agent" , ( done ) => {
48+ request ( server )
49+ . get ( "/" )
50+ . set ( "Accept" , "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" )
51+ . set ( "Accept-Encoding" , "gzip, deflate, br" )
52+ . set ( "User-Agent" , "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36" )
53+ . expect ( r => {
54+ expect ( r . text ) . to . be . a ( "string" ) . and . satisfy ( body => body . startsWith ( "<!doctype html>" ) ) ;
55+ assert . equal ( r . headers [ "content-encoding" ] , "gzip" ) ;
56+ } )
57+ . expect ( 200 , done ) ;
58+ } ) ;
59+
60+ it ( "[DEBUG] returns good content for / with accept-encoding and User-Agent" , ( done ) => {
4861 request ( server )
4962 . get ( "/" )
5063 . redirects ( 1 )
@@ -69,7 +82,27 @@ describe("express with google upstream and botli decompress", function () {
6982 it ( "returns good content for / with chrome headers" , ( done ) => {
7083 request ( server )
7184 . get ( "/" )
72- . redirects ( 1 )
85+ . set ( "Accept" , "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" )
86+ . set ( "Accept-Encoding" , "gzip, deflate, br" )
87+ . set ( "Cache-Control" , "no-cache" )
88+ . set ( "Connection" , "keep-alive" )
89+ . set ( "Pragma" , "no-cache" )
90+ . set ( "Sec-Fetch-Dest" , "document" )
91+ . set ( "Sec-Fetch-Mode" , "navigate" )
92+ . set ( "Sec-Fetch-Site" , "none" )
93+ . set ( "Sec-Fetch-User" , "?1" )
94+ . set ( "Upgrade-Insecure-Requests" , "1" )
95+ . set ( "User-Agent" , "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36" )
96+ . expect ( r => {
97+ expect ( r . text ) . to . be . a ( "string" ) . and . satisfy ( body => body . startsWith ( "<!doctype html>" ) ) ;
98+ assert . equal ( r . headers [ "content-encoding" ] , "gzip" ) ;
99+ } )
100+ . expect ( 200 , done ) ;
101+ } ) ;
102+
103+ it ( "[DEBUG] returns good content for / with chrome headers" , ( done ) => {
104+ request ( server )
105+ . get ( "/" )
73106 . set ( "Accept" , "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" )
74107 . set ( "Accept-Encoding" , "gzip, deflate, br" )
75108 . set ( "Cache-Control" , "no-cache" )
@@ -127,7 +160,6 @@ describe("express with google upstream without botli decompress", function () {
127160 it ( "returns content-encoding br / with accept-encoding and User-Agent" , ( done ) => {
128161 request ( server )
129162 . get ( "/" )
130- . redirects ( 1 )
131163 . set ( "Accept" , "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" )
132164 . set ( "Accept-Encoding" , "gzip, deflate, br" )
133165 . set ( "User-Agent" , "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36" )
0 commit comments