@@ -9,13 +9,6 @@ import * as path from 'path';
99
1010let sampleFilePath : string = path . join ( __dirname , 'testoutput.txt' ) ;
1111
12- const nodeVersionsWithCertificateErrors = [ 6 , 8 ] ;
13- let redirectProtocol = 'https' ;
14- if ( nodeVersionsWithCertificateErrors . find ( ( nodeVersion ) => process . version . startsWith ( `v${ nodeVersion } .` ) ) ) {
15- console . log ( 'Using protocol HTTP for redirect tests to avoid certificate errors on this node version' ) ;
16- redirectProtocol = 'http' ;
17- }
18-
1912describe ( 'Http Tests' , function ( ) {
2013 let _http : httpm . HttpClient ;
2114 let _httpbin : httpm . HttpClient ;
@@ -186,30 +179,30 @@ describe('Http Tests', function () {
186179 } ) ;
187180
188181 it ( 'does basic get request with redirects' , async ( ) => {
189- let res : httpm . HttpClientResponse = await _http . get ( `${ redirectProtocol } ://httpbingo .org/redirect-to?url=` + encodeURIComponent ( "https://httpbin.org/get " ) )
182+ let res : httpm . HttpClientResponse = await _http . get ( `https ://httpbin .org/redirect-to?url=` + encodeURIComponent ( "https://httpbin.org/anything " ) )
190183 assert ( res . message . statusCode == 200 , "status code should be 200" ) ;
191184 let body : string = await res . readBody ( ) ;
192185 let obj :any = JSON . parse ( body ) ;
193- assert ( obj . url === "https://httpbin.org/get " ) ;
186+ assert ( obj . url === "https://httpbin.org/anything " ) ;
194187 } ) ;
195188
196189 it ( 'does basic get request with redirects (303)' , async ( ) => {
197- let res : httpm . HttpClientResponse = await _http . get ( `${ redirectProtocol } ://httpbingo .org/redirect-to?url=` + encodeURIComponent ( "https://httpbin.org/get " ) + '&status_code=303' )
190+ let res : httpm . HttpClientResponse = await _http . get ( `https ://httpbin .org/redirect-to?url=` + encodeURIComponent ( "https://httpbin.org/anything " ) + '&status_code=303' )
198191 assert ( res . message . statusCode == 200 , "status code should be 200" ) ;
199192 let body : string = await res . readBody ( ) ;
200193 let obj :any = JSON . parse ( body ) ;
201- assert ( obj . url === "https://httpbin.org/get " ) ;
194+ assert ( obj . url === "https://httpbin.org/anything " ) ;
202195 } ) ;
203196
204197 it ( 'returns 404 for not found get request on redirect' , async ( ) => {
205- let res : httpm . HttpClientResponse = await _http . get ( `${ redirectProtocol } ://httpbingo .org/redirect-to?url=` + encodeURIComponent ( "https://httpbin.org/status/404" ) + '&status_code=303' )
198+ let res : httpm . HttpClientResponse = await _http . get ( `https ://httpbin .org/redirect-to?url=` + encodeURIComponent ( "https://httpbin.org/status/404" ) + '&status_code=303' )
206199 assert ( res . message . statusCode == 404 , "status code should be 404" ) ;
207200 let body : string = await res . readBody ( ) ;
208201 } ) ;
209202
210203 it ( 'does not follow redirects if disabled' , async ( ) => {
211204 let http : httpm . HttpClient = new httpm . HttpClient ( 'typed-test-client-tests' , null , { allowRedirects : false } ) ;
212- let res : httpm . HttpClientResponse = await http . get ( `${ redirectProtocol } ://httpbingo .org/redirect-to?url=` + encodeURIComponent ( "https://httpbin.org/get " ) )
205+ let res : httpm . HttpClientResponse = await http . get ( `https ://httpbin .org/redirect-to?url=` + encodeURIComponent ( "https://httpbin.org/anything " ) )
213206 assert ( res . message . statusCode == 302 , "status code should be 302" ) ;
214207 let body : string = await res . readBody ( ) ;
215208 } ) ;
0 commit comments