Skip to content

Commit eac83af

Browse files
release: 3.6.3 (#595)
Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 8f943a3 commit eac83af

File tree

6 files changed

+25
-5
lines changed

6 files changed

+25
-5
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "3.6.2"
2+
".": "3.6.3"
33
}

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## 3.6.3 (2026-02-03)
4+
5+
Full Changelog: [v3.6.2...v3.6.3](https://github.com/val-town/sdk/compare/v3.6.2...v3.6.3)
6+
7+
### Bug Fixes
8+
9+
* **client:** avoid memory leak with abort signals ([e6d2431](https://github.com/val-town/sdk/commit/e6d243134eea332ae0f99f65754417a2544f2d30))
10+
11+
12+
### Chores
13+
14+
* **client:** do not parse responses with empty content-length ([0c45396](https://github.com/val-town/sdk/commit/0c453969380851d24851eec6d38c433b37572977))
15+
316
## 3.6.2 (2026-01-24)
417

518
Full Changelog: [v3.6.1...v3.6.2](https://github.com/val-town/sdk/compare/v3.6.1...v3.6.2)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@valtown/sdk",
3-
"version": "3.6.2",
3+
"version": "3.6.3",
44
"description": "The official TypeScript library for the Val Town API",
55
"author": "Val Town <support@val.town>",
66
"types": "dist/index.d.ts",

src/client.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,10 @@ export class ValTown {
517517
controller: AbortController,
518518
): Promise<Response> {
519519
const { signal, method, ...options } = init || {};
520-
if (signal) signal.addEventListener('abort', () => controller.abort());
520+
const abort = controller.abort.bind(controller);
521+
if (signal) signal.addEventListener('abort', abort, { once: true });
521522

522-
const timeout = setTimeout(() => controller.abort(), ms);
523+
const timeout = setTimeout(abort, ms);
523524

524525
const isReadableBody =
525526
((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||

src/internal/parse.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ export async function defaultParseResponse<T>(client: ValTown, props: APIRespons
2929
const mediaType = contentType?.split(';')[0]?.trim();
3030
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
3131
if (isJSON) {
32+
const contentLength = response.headers.get('content-length');
33+
if (contentLength === '0') {
34+
// if there is no content we can't do anything
35+
return undefined as T;
36+
}
37+
3238
const json = await response.json();
3339
return json as T;
3440
}

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VERSION = '3.6.2'; // x-release-please-version
1+
export const VERSION = '3.6.3'; // x-release-please-version

0 commit comments

Comments
 (0)