mirror of
https://github.com/actions/cache.git
synced 2025-07-10 21:00:46 +00:00
Consume @actions/http-client:1.0.5
This commit is contained in:
parent
f37c19eacb
commit
a0d78414ab
3 changed files with 11 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue