add digest header for uploads

This commit is contained in:
Rob Herley
2022-04-04 17:54:15 -04:00
parent f8a69bc473
commit c5d1911357
2 changed files with 27 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ import {
UploadResults
} from './contracts'
import {
digestForStream,
getArtifactUrl,
getContentRange,
getUploadHeaders,
@@ -406,6 +407,9 @@ export class UploadHttpClient {
isGzip: boolean,
totalFileSize: number
): Promise<boolean> {
// open a new stream and read it to compute the digest
const digest = await digestForStream(openStream())
// prepare all the necessary headers before making any http call
const headers = getUploadHeaders(
'application/octet-stream',
@@ -413,7 +417,8 @@ export class UploadHttpClient {
isGzip,
totalFileSize,
end - start + 1,
getContentRange(start, end, uploadFileSize)
getContentRange(start, end, uploadFileSize),
digest
)
const uploadChunkRequest = async (): Promise<IHttpClientResponse> => {