Skip to content
This repository was archived by the owner on May 3, 2022. It is now read-only.

Commit 943067f

Browse files
it's pretty now and bump version
1 parent fbd1377 commit 943067f

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

__tests__/basics.test.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -181,47 +181,47 @@ describe('basics', () => {
181181

182182
it('does not pass auth with diff hostname redirects', async done => {
183183
let headers = {
184-
"accept": "application/json",
185-
"authorization": "shhh"
184+
accept: 'application/json',
185+
authorization: 'shhh'
186186
}
187187
let res: httpm.HttpClientResponse = await _http.get(
188188
'https://httpbin.org/redirect-to?url=' +
189189
encodeURIComponent('https://www.httpbin.org/get'),
190-
headers
190+
headers
191191
)
192192

193193
expect(res.message.statusCode).toBe(200)
194194
let body: string = await res.readBody()
195195
let obj: any = JSON.parse(body)
196196
// httpbin "fixes" the casing
197-
expect(obj.headers["Authorization"]).toBeUndefined()
198-
expect(obj.headers["authorization"]).toBeUndefined()
197+
expect(obj.headers['Authorization']).toBeUndefined()
198+
expect(obj.headers['authorization']).toBeUndefined()
199199
expect(obj.url).toBe('https://www.httpbin.org/get')
200200

201201
done()
202202
})
203-
203+
204204
it('does not pass Auth with diff hostname redirects', async done => {
205205
let headers = {
206-
"Accept": "application/json",
207-
"Authorization": "shhh"
206+
Accept: 'application/json',
207+
Authorization: 'shhh'
208208
}
209209
let res: httpm.HttpClientResponse = await _http.get(
210210
'https://httpbin.org/redirect-to?url=' +
211211
encodeURIComponent('https://www.httpbin.org/get'),
212-
headers
212+
headers
213213
)
214214

215215
expect(res.message.statusCode).toBe(200)
216216
let body: string = await res.readBody()
217217
let obj: any = JSON.parse(body)
218218
// httpbin "fixes" the casing
219-
expect(obj.headers["Authorization"]).toBeUndefined()
220-
expect(obj.headers["authorization"]).toBeUndefined()
219+
expect(obj.headers['Authorization']).toBeUndefined()
220+
expect(obj.headers['authorization']).toBeUndefined()
221221
expect(obj.url).toBe('https://www.httpbin.org/get')
222222

223223
done()
224-
})
224+
})
225225

226226
it('does basic head request', async done => {
227227
let res: httpm.HttpClientResponse = await _http.head(

index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,10 @@ export class HttpClient {
388388

389389
// strip authorization header if redirected to a different hostname
390390
if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
391-
for(let header in headers){
391+
for (let header in headers) {
392392
// header names are case insensitive
393-
if (header.toLowerCase() === "authorization") {
394-
delete headers[header]
393+
if (header.toLowerCase() === 'authorization') {
394+
delete headers[header]
395395
}
396396
}
397397
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@actions/http-client",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "Actions Http Client",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)