Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Changelog

_Note: Gaps between patch versions are faulty, broken or test releases._

## v3.101.2 (2024-12-09)

#### :bug: Bug Fix

* Fixed an issue when receiving an empty string with the `Content-Type: application/octet-stream` header `core/request/response`

## v3.101.1 (2024-10-21)

#### :bug: Bug Fix
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "lib/core/index.js",
"typings": "index.d.ts",
"license": "MIT",
"version": "3.101.1",
"version": "3.101.2",
"author": "kobezzza <kobezzza@gmail.com> (https://github.com/kobezzza)",
"repository": {
"type": "git",
Expand Down
6 changes: 6 additions & 0 deletions src/core/request/response/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ Changelog
> - :house: [Internal]
> - :nail_care: [Polish]

## v3.101.2 (2024-12-09)

#### :bug: Bug Fix

* Fixed an issue when receiving an empty string with the `Content-Type: application/octet-stream` header `core/request/response`

## v3.93.0 (2023-03-14)

#### :rocket: New Feature
Expand Down
2 changes: 1 addition & 1 deletion src/core/request/response/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ export default class Response<
@once
arrayBuffer(): AbortablePromise<ArrayBuffer> {
return this.readBody().then((body) => {
if (body == null) {
if (body == null || body === '') {
return new ArrayBuffer(0);
}

Expand Down
19 changes: 19 additions & 0 deletions src/core/request/response/test/main.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Response } from 'core/request';
import V4Headers from 'core/request/headers';

describe('core/request/response', () => {
test([
'should successfully handle a request with the Content-Type: application/octet-stream header',
'and an empty response body'
].join(' '), async () => {

const response = new Response(Promise.resolve(''), {
url: 'url/url',
headers: new V4Headers({
'Content-Type': 'application/octet-stream'
})
});

await expect(response.decode()).resolves.toBeInstanceOf(ArrayBuffer);
});
});