diff --git a/lib/common/lib/range.ts b/lib/common/lib/range.ts index 338b786f00..678521b801 100644 --- a/lib/common/lib/range.ts +++ b/lib/common/lib/range.ts @@ -49,6 +49,13 @@ export class Range { } let range: Range = new Range(startByte, endByte, contentLength); return range; - return; + } + + toHeaderValue() { + if (this.startByte === null && this.endByte === null) { + throw Error("Failed to parse range object to a valid header value: " + JSON.stringify(this)); + } + + return `bytes=${this.startByte ?? ""}-${this.endByte ?? ""}`; } } diff --git a/lib/objectstorage/lib/client.ts b/lib/objectstorage/lib/client.ts index 9db9185301..7d896dc85b 100644 --- a/lib/objectstorage/lib/client.ts +++ b/lib/objectstorage/lib/client.ts @@ -1710,7 +1710,7 @@ Any user with the OBJECTSTORAGE_NAMESPACE_READ permission will be able to see th "if-match": getObjectRequest.ifMatch, "if-none-match": getObjectRequest.ifNoneMatch, "opc-client-request-id": getObjectRequest.opcClientRequestId, - "range": getObjectRequest.range, + "range": getObjectRequest.range?.toHeaderValue(), "opc-sse-customer-algorithm": getObjectRequest.opcSseCustomerAlgorithm, "opc-sse-customer-key": getObjectRequest.opcSseCustomerKey, "opc-sse-customer-key-sha256": getObjectRequest.opcSseCustomerKeySha256