mirror of
https://github.com/actions/http-client.git
synced 2025-04-22 18:22:28 +00:00
Merge 5339fe5e6e
into 5f61f72a73
This commit is contained in:
commit
b480ea7463
17
index.ts
17
index.ts
@ -44,6 +44,17 @@ export enum MediaTypes {
|
|||||||
ApplicationJson = 'application/json'
|
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.
|
* 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
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
@ -567,9 +578,6 @@ export class HttpClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _mergeHeaders(headers: ifm.IHeaders): ifm.IHeaders {
|
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) {
|
if (this.requestOptions && this.requestOptions.headers) {
|
||||||
return Object.assign(
|
return Object.assign(
|
||||||
{},
|
{},
|
||||||
@ -586,9 +594,6 @@ export class HttpClient {
|
|||||||
header: string,
|
header: string,
|
||||||
_default: string
|
_default: string
|
||||||
) {
|
) {
|
||||||
const lowercaseKeys = obj =>
|
|
||||||
Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {})
|
|
||||||
|
|
||||||
let clientHeader: string
|
let clientHeader: string
|
||||||
if (this.requestOptions && this.requestOptions.headers) {
|
if (this.requestOptions && this.requestOptions.headers) {
|
||||||
clientHeader = lowercaseKeys(this.requestOptions.headers)[header]
|
clientHeader = lowercaseKeys(this.requestOptions.headers)[header]
|
||||||
|
Loading…
Reference in New Issue
Block a user