mirror of
https://github.com/actions/http-client.git
synced 2025-02-25 00:52:46 +00:00
it's pretty now and bump version
This commit is contained in:
parent
fbd137758a
commit
943067fe4c
@ -181,8 +181,8 @@ describe('basics', () => {
|
||||
|
||||
it('does not pass auth with diff hostname redirects', async done => {
|
||||
let headers = {
|
||||
"accept": "application/json",
|
||||
"authorization": "shhh"
|
||||
accept: 'application/json',
|
||||
authorization: 'shhh'
|
||||
}
|
||||
let res: httpm.HttpClientResponse = await _http.get(
|
||||
'https://httpbin.org/redirect-to?url=' +
|
||||
@ -194,8 +194,8 @@ describe('basics', () => {
|
||||
let body: string = await res.readBody()
|
||||
let obj: any = JSON.parse(body)
|
||||
// httpbin "fixes" the casing
|
||||
expect(obj.headers["Authorization"]).toBeUndefined()
|
||||
expect(obj.headers["authorization"]).toBeUndefined()
|
||||
expect(obj.headers['Authorization']).toBeUndefined()
|
||||
expect(obj.headers['authorization']).toBeUndefined()
|
||||
expect(obj.url).toBe('https://www.httpbin.org/get')
|
||||
|
||||
done()
|
||||
@ -203,8 +203,8 @@ describe('basics', () => {
|
||||
|
||||
it('does not pass Auth with diff hostname redirects', async done => {
|
||||
let headers = {
|
||||
"Accept": "application/json",
|
||||
"Authorization": "shhh"
|
||||
Accept: 'application/json',
|
||||
Authorization: 'shhh'
|
||||
}
|
||||
let res: httpm.HttpClientResponse = await _http.get(
|
||||
'https://httpbin.org/redirect-to?url=' +
|
||||
@ -216,8 +216,8 @@ describe('basics', () => {
|
||||
let body: string = await res.readBody()
|
||||
let obj: any = JSON.parse(body)
|
||||
// httpbin "fixes" the casing
|
||||
expect(obj.headers["Authorization"]).toBeUndefined()
|
||||
expect(obj.headers["authorization"]).toBeUndefined()
|
||||
expect(obj.headers['Authorization']).toBeUndefined()
|
||||
expect(obj.headers['authorization']).toBeUndefined()
|
||||
expect(obj.url).toBe('https://www.httpbin.org/get')
|
||||
|
||||
done()
|
||||
|
2
index.ts
2
index.ts
@ -390,7 +390,7 @@ export class HttpClient {
|
||||
if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
|
||||
for (let header in headers) {
|
||||
// header names are case insensitive
|
||||
if (header.toLowerCase() === "authorization") {
|
||||
if (header.toLowerCase() === 'authorization') {
|
||||
delete headers[header]
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@actions/http-client",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.8",
|
||||
"description": "Actions Http Client",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
Loading…
Reference in New Issue
Block a user