@@ -9,13 +9,6 @@ import * as path from 'path';
9
9
10
10
let sampleFilePath : string = path . join ( __dirname , 'testoutput.txt' ) ;
11
11
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
-
19
12
describe ( 'Http Tests' , function ( ) {
20
13
let _http : httpm . HttpClient ;
21
14
let _httpbin : httpm . HttpClient ;
@@ -186,30 +179,30 @@ describe('Http Tests', function () {
186
179
} ) ;
187
180
188
181
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 " ) )
190
183
assert ( res . message . statusCode == 200 , "status code should be 200" ) ;
191
184
let body : string = await res . readBody ( ) ;
192
185
let obj :any = JSON . parse ( body ) ;
193
- assert ( obj . url === "https://httpbin.org/get " ) ;
186
+ assert ( obj . url === "https://httpbin.org/anything " ) ;
194
187
} ) ;
195
188
196
189
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' )
198
191
assert ( res . message . statusCode == 200 , "status code should be 200" ) ;
199
192
let body : string = await res . readBody ( ) ;
200
193
let obj :any = JSON . parse ( body ) ;
201
- assert ( obj . url === "https://httpbin.org/get " ) ;
194
+ assert ( obj . url === "https://httpbin.org/anything " ) ;
202
195
} ) ;
203
196
204
197
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' )
206
199
assert ( res . message . statusCode == 404 , "status code should be 404" ) ;
207
200
let body : string = await res . readBody ( ) ;
208
201
} ) ;
209
202
210
203
it ( 'does not follow redirects if disabled' , async ( ) => {
211
204
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 " ) )
213
206
assert ( res . message . statusCode == 302 , "status code should be 302" ) ;
214
207
let body : string = await res . readBody ( ) ;
215
208
} ) ;
0 commit comments