mirror of
https://github.com/actions/http-client.git
synced 2025-04-22 02:02:29 +00:00
Don't redefine lowercaseKeys
This commit is contained in:
parent
ab10999b09
commit
5339fe5e6e
17
index.ts
17
index.ts
@ -45,6 +45,17 @@ export enum MediaTypes {
|
||||
ApplicationJson = 'application/json'
|
||||
}
|
||||
|
||||
interface StrObject {
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
function lowercaseKeys(obj: StrObject) {
|
||||
return Object.keys(obj).reduce(
|
||||
(c: StrObject, k) => ((c[k.toLowerCase()] = obj[k]), c),
|
||||
{}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||
@ -558,9 +569,6 @@ export class HttpClient {
|
||||
}
|
||||
|
||||
private _mergeHeaders(headers: ifm.IHeaders): ifm.IHeaders {
|
||||
const lowercaseKeys = obj =>
|
||||
Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {})
|
||||
|
||||
if (this.requestOptions && this.requestOptions.headers) {
|
||||
return Object.assign(
|
||||
{},
|
||||
@ -577,9 +585,6 @@ export class HttpClient {
|
||||
header: string,
|
||||
_default: string
|
||||
) {
|
||||
const lowercaseKeys = obj =>
|
||||
Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {})
|
||||
|
||||
let clientHeader: string
|
||||
if (this.requestOptions && this.requestOptions.headers) {
|
||||
clientHeader = lowercaseKeys(this.requestOptions.headers)[header]
|
||||
|
Loading…
Reference in New Issue
Block a user