artifact header cleanup (#441)

* Update NPM packages for @actions/artifact

* Clarifications around headers

* Revert NPM updates

* Apply suggestions from code review

Co-authored-by: Josh Gross <joshmgross@github.com>

Co-authored-by: Josh Gross <joshmgross@github.com>
This commit is contained in:
Konrad Pabjan
2020-05-12 17:48:36 +02:00
committed by GitHub
parent d1b52e7168
commit 0471ed4ad7
4 changed files with 47 additions and 52 deletions

View File

@@ -62,7 +62,6 @@ export function isForbiddenStatusCode(statusCode?: number): boolean {
if (!statusCode) {
return false
}
return statusCode === HttpCodes.Forbidden
}
@@ -84,7 +83,6 @@ export function isThrottledStatusCode(statusCode?: number): boolean {
if (!statusCode) {
return false
}
return statusCode === HttpCodes.TooManyRequests
}
@@ -133,9 +131,9 @@ export function getContentRange(
* @param {boolean} isKeepAlive is the same connection being used to make multiple calls
* @param {boolean} acceptGzip can we accept a gzip encoded response
* @param {string} acceptType the type of content that we can accept
* @returns appropriate request options to make a specific http call during artifact download
* @returns appropriate headers to make a specific http call during artifact download
*/
export function getDownloadRequestOptions(
export function getDownloadHeaders(
contentType: string,
isKeepAlive?: boolean,
acceptGzip?: boolean
@@ -172,9 +170,9 @@ export function getDownloadRequestOptions(
* @param {number} uncompressedLength the original size of the content if something is being uploaded that has been compressed
* @param {number} contentLength the length of the content that is being uploaded
* @param {string} contentRange the range of the content that is being uploaded
* @returns appropriate request options to make a specific http call during artifact upload
* @returns appropriate headers to make a specific http call during artifact upload
*/
export function getUploadRequestOptions(
export function getUploadHeaders(
contentType: string,
isKeepAlive?: boolean,
isGzip?: boolean,
@@ -207,7 +205,7 @@ export function getUploadRequestOptions(
}
export function createHttpClient(): HttpClient {
return new HttpClient('action/artifact', [
return new HttpClient('actions/artifact', [
new BearerCredentialHandler(getRuntimeToken())
])
}