mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-16 16:01:22 +02:00
Dont send headers manually, http-client automatically will
This commit is contained in:
parent
f726af703b
commit
ac9a0a0a78
1 changed files with 2 additions and 10 deletions
|
@ -133,13 +133,9 @@ export async function reserveCache(key: string): Promise<number> {
|
||||||
const reserveCacheRequest: ReserveCacheRequest = {
|
const reserveCacheRequest: ReserveCacheRequest = {
|
||||||
key
|
key
|
||||||
};
|
};
|
||||||
const additionalHeaders = {
|
|
||||||
"Content-Type": "application/json"
|
|
||||||
};
|
|
||||||
const response = await httpClient.postJson<ReserveCacheResponse>(
|
const response = await httpClient.postJson<ReserveCacheResponse>(
|
||||||
getCacheApiUrl("caches"),
|
getCacheApiUrl("caches"),
|
||||||
reserveCacheRequest,
|
reserveCacheRequest
|
||||||
additionalHeaders
|
|
||||||
);
|
);
|
||||||
return response?.result?.cacheId ?? -1;
|
return response?.result?.cacheId ?? -1;
|
||||||
}
|
}
|
||||||
|
@ -269,13 +265,9 @@ async function commitCache(
|
||||||
filesize: number
|
filesize: number
|
||||||
): Promise<ITypedResponse<null>> {
|
): Promise<ITypedResponse<null>> {
|
||||||
const commitCacheRequest: CommitCacheRequest = { size: filesize };
|
const commitCacheRequest: CommitCacheRequest = { size: filesize };
|
||||||
const additionalHeaders = {
|
|
||||||
"Content-Type": "application/json"
|
|
||||||
};
|
|
||||||
return await httpClient.postJson<null>(
|
return await httpClient.postJson<null>(
|
||||||
getCacheApiUrl(`caches/${cacheId.toString()}`),
|
getCacheApiUrl(`caches/${cacheId.toString()}`),
|
||||||
commitCacheRequest,
|
commitCacheRequest
|
||||||
additionalHeaders
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue