Fix resource URLs

joshmgross/chunked-upload-testing
Josh Gross 5 years ago
parent 577b274c51
commit b25804d19e

@ -1605,7 +1605,6 @@ function uploadChunk(restClient, resourceUrl, data, start, end) {
"Content-Type": "application/octet-stream",
"Content-Range": getContentRange(start, end)
};
core.debug(`Resource URL: ${resourceUrl}`);
return yield restClient.uploadStream("PATCH", resourceUrl, data, requestOptions);
});
}
@ -1613,7 +1612,7 @@ function commitCache(restClient, cacheId, filesize) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = getRequestOptions();
const commitCacheRequest = { size: filesize };
return yield restClient.create(cacheId.toString(), commitCacheRequest, requestOptions);
return yield restClient.create(`caches/${cacheId.toString()}`, commitCacheRequest, requestOptions);
});
}
function saveCache(cacheId, archivePath) {
@ -1622,7 +1621,7 @@ function saveCache(cacheId, archivePath) {
core.debug("Uploading chunks");
// Upload Chunks
const fileSize = fs.statSync(archivePath).size;
const resourceUrl = getCacheApiUrl() + cacheId.toString();
const resourceUrl = getCacheApiUrl() + "caches/" + cacheId.toString();
const uploads = [];
let offset = 0;
while (offset < fileSize) {

@ -1605,7 +1605,6 @@ function uploadChunk(restClient, resourceUrl, data, start, end) {
"Content-Type": "application/octet-stream",
"Content-Range": getContentRange(start, end)
};
core.debug(`Resource URL: ${resourceUrl}`);
return yield restClient.uploadStream("PATCH", resourceUrl, data, requestOptions);
});
}
@ -1613,7 +1612,7 @@ function commitCache(restClient, cacheId, filesize) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = getRequestOptions();
const commitCacheRequest = { size: filesize };
return yield restClient.create(cacheId.toString(), commitCacheRequest, requestOptions);
return yield restClient.create(`caches/${cacheId.toString()}`, commitCacheRequest, requestOptions);
});
}
function saveCache(cacheId, archivePath) {
@ -1622,7 +1621,7 @@ function saveCache(cacheId, archivePath) {
core.debug("Uploading chunks");
// Upload Chunks
const fileSize = fs.statSync(archivePath).size;
const resourceUrl = getCacheApiUrl() + cacheId.toString();
const resourceUrl = getCacheApiUrl() + "caches/" + cacheId.toString();
const uploads = [];
let offset = 0;
while (offset < fileSize) {

@ -157,7 +157,6 @@ async function uploadChunk(
"Content-Range": getContentRange(start, end)
};
core.debug(`Resource URL: ${resourceUrl}`);
return await restClient.uploadStream<void>("PATCH", resourceUrl, data, requestOptions);
}
@ -169,7 +168,7 @@ async function commitCache(
const requestOptions = getRequestOptions();
const commitCacheRequest: CommitCacheRequest = { size: filesize };
return await restClient.create(
cacheId.toString(),
`caches/${cacheId.toString()}`,
commitCacheRequest,
requestOptions
);
@ -184,7 +183,7 @@ export async function saveCache(
core.debug("Uploading chunks");
// Upload Chunks
const fileSize = fs.statSync(archivePath).size;
const resourceUrl = getCacheApiUrl() + cacheId.toString();
const resourceUrl = getCacheApiUrl() + "caches/" + cacheId.toString();
const uploads: Promise<IRestResponse<void>>[] = [];
let offset = 0;
while (offset < fileSize) {

Loading…
Cancel
Save