1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2025-04-19 19:46:17 +02:00

Consume @actions/http-client:1.0.5

This commit is contained in:
David Kale 2020-02-04 08:41:38 -05:00
parent f37c19eacb
commit a0d78414ab
3 changed files with 11 additions and 10 deletions

6
package-lock.json generated
View file

@ -15,9 +15,9 @@
"integrity": "sha512-nvFkxwiicvpzNiCBF4wFBDfnBvi7xp/as7LE1hBxBxKG2L29+gkIPBiLKMVORL+Hg3JNf07AKRfl0V5djoypjQ=="
},
"@actions/http-client": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.4.tgz",
"integrity": "sha512-6EzXhqapKKtYr21ZnFQVBYwfrYPKPCivuSkUN/66/BDakkH2EPjUZH8tZ3MgHdI+gQIdcsY0ybbxw9ZEOmJB6g==",
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.5.tgz",
"integrity": "sha512-kX9T1EwfohZU/iTHei0nQlykxdTV9xvKMeHYTtYkfkgBKoe2Z0z0IP3ANVYTsFAlycMwLheBhVEBTm2XvGhR1Q==",
"requires": {
"tunnel": "0.0.6"
}

View file

@ -26,7 +26,7 @@
"dependencies": {
"@actions/core": "^1.2.0",
"@actions/exec": "^1.0.1",
"@actions/http-client": "^1.0.4",
"@actions/http-client": "^1.0.5",
"@actions/io": "^1.0.1",
"uuid": "^3.3.3"
},

View file

@ -1,16 +1,17 @@
import * as core from "@actions/core";
import * as fs from "fs";
import { BearerCredentialHandler } from "@actions/http-client/auth";
import { HttpClient, HttpCodes, ITypedResponse } from "@actions/http-client";
import { HttpClient, HttpCodes } from "@actions/http-client";
import {
IHttpClientResponse,
IRequestOptions,
IHeaders
ITypedResponse
} from "@actions/http-client/interfaces";
import {
ArtifactCacheEntry,
CommitCacheRequest,
ReserveCacheRequest
ReserveCacheRequest,
ReserveCacheResponse
} from "./contracts";
import * as utils from "./utils/actionUtils";
@ -135,7 +136,7 @@ export async function reserveCache(key: string): Promise<number> {
const additionalHeaders = {
"Content-Type": "application/json"
};
const response = await httpClient.postJson<any>(
const response = await httpClient.postJson<ReserveCacheResponse>(
getCacheApiUrl("caches"),
reserveCacheRequest,
additionalHeaders
@ -266,12 +267,12 @@ async function commitCache(
httpClient: HttpClient,
cacheId: number,
filesize: number
): Promise<ITypedResponse<any>> {
): Promise<ITypedResponse<null>> {
const commitCacheRequest: CommitCacheRequest = { size: filesize };
const additionalHeaders = {
"Content-Type": "application/json"
};
return await httpClient.postJson<any>(
return await httpClient.postJson<null>(
getCacheApiUrl(`caches/${cacheId.toString()}`),
commitCacheRequest,
additionalHeaders