@@ -179,6 +179,50 @@ describe('basics', () => {
179
179
done ( )
180
180
} )
181
181
182
+ it ( 'does not pass auth with diff hostname redirects' , async done => {
183
+ let headers = {
184
+ "accept" : "application/json" ,
185
+ "authorization" : "shhh"
186
+ }
187
+ let res : httpm . HttpClientResponse = await _http . get (
188
+ 'https://httpbin.org/redirect-to?url=' +
189
+ encodeURIComponent ( 'https://www.httpbin.org/get' ) ,
190
+ headers
191
+ )
192
+
193
+ expect ( res . message . statusCode ) . toBe ( 200 )
194
+ let body : string = await res . readBody ( )
195
+ let obj : any = JSON . parse ( body )
196
+ // httpbin "fixes" the casing
197
+ expect ( obj . headers [ "Authorization" ] ) . toBeUndefined ( )
198
+ expect ( obj . headers [ "authorization" ] ) . toBeUndefined ( )
199
+ expect ( obj . url ) . toBe ( 'https://www.httpbin.org/get' )
200
+
201
+ done ( )
202
+ } )
203
+
204
+ it ( 'does not pass Auth with diff hostname redirects' , async done => {
205
+ let headers = {
206
+ "Accept" : "application/json" ,
207
+ "Authorization" : "shhh"
208
+ }
209
+ let res : httpm . HttpClientResponse = await _http . get (
210
+ 'https://httpbin.org/redirect-to?url=' +
211
+ encodeURIComponent ( 'https://www.httpbin.org/get' ) ,
212
+ headers
213
+ )
214
+
215
+ expect ( res . message . statusCode ) . toBe ( 200 )
216
+ let body : string = await res . readBody ( )
217
+ let obj : any = JSON . parse ( body )
218
+ // httpbin "fixes" the casing
219
+ expect ( obj . headers [ "Authorization" ] ) . toBeUndefined ( )
220
+ expect ( obj . headers [ "authorization" ] ) . toBeUndefined ( )
221
+ expect ( obj . url ) . toBe ( 'https://www.httpbin.org/get' )
222
+
223
+ done ( )
224
+ } )
225
+
182
226
it ( 'does basic head request' , async done => {
183
227
let res : httpm . HttpClientResponse = await _http . head (
184
228
'http://httpbin.org/get'
0 commit comments