From 6fae7c2522865ca8dcba008939c272ce61370731 Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Mon, 17 Jul 2023 17:28:22 -0300 Subject: [PATCH] =?UTF-8?q?Rename=20RequestCallback=E2=80=99s=20`packed`?= =?UTF-8?q?=20param=20to=20`unpacked`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is how it's named at the call sites of rest.http.do, and it’s consistent with how its value is being populated in web/lib/transport/fetchrequest.ts and how its value is being used (i.e. if its false then we need to deserialize). --- src/common/types/http.d.ts | 2 +- src/platform/nodejs/lib/util/http.ts | 2 +- src/platform/web/lib/transport/fetchrequest.ts | 6 +++--- src/platform/web/lib/util/http.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/types/http.d.ts b/src/common/types/http.d.ts index bd3b33fa59..c3f454d475 100644 --- a/src/common/types/http.d.ts +++ b/src/common/types/http.d.ts @@ -8,7 +8,7 @@ export type RequestCallback = ( error?: ErrnoException | IPartialErrorInfo | null, body?: unknown, headers?: IncomingHttpHeaders, - packed?: boolean, + unpacked?: boolean, statusCode?: number ) => void; export type RequestParams = Record | null; diff --git a/src/platform/nodejs/lib/util/http.ts b/src/platform/nodejs/lib/util/http.ts index 0b2c3307d2..a6e757f37e 100644 --- a/src/platform/nodejs/lib/util/http.ts +++ b/src/platform/nodejs/lib/util/http.ts @@ -261,7 +261,7 @@ const Http: typeof IHttp = class { err?: ErrnoException | ErrorInfo | null, responseText?: unknown, headers?: any, - packed?: boolean, + unpacked?: boolean, statusCode?: number ) { if (!err && !connectivityUrlIsDefault) { diff --git a/src/platform/web/lib/transport/fetchrequest.ts b/src/platform/web/lib/transport/fetchrequest.ts index 360b3f5a5b..9af6592628 100644 --- a/src/platform/web/lib/transport/fetchrequest.ts +++ b/src/platform/web/lib/transport/fetchrequest.ts @@ -63,7 +63,7 @@ export default function fetchRequest( prom = res.text(); } prom.then((body) => { - const packed = !!contentType && contentType.indexOf('application/x-msgpack') === -1; + const unpacked = !!contentType && contentType.indexOf('application/x-msgpack') === -1; if (!res.ok) { const err = getAblyError(body, res.headers) || @@ -72,9 +72,9 @@ export default function fetchRequest( null, res.status ); - callback(err, body, res.headers, packed, res.status); + callback(err, body, res.headers, unpacked, res.status); } else { - callback(null, body, res.headers, packed, res.status); + callback(null, body, res.headers, unpacked, res.status); } }); }) diff --git a/src/platform/web/lib/util/http.ts b/src/platform/web/lib/util/http.ts index c0b5942375..2be9519de7 100644 --- a/src/platform/web/lib/util/http.ts +++ b/src/platform/web/lib/util/http.ts @@ -100,7 +100,7 @@ const Http: typeof IHttp = class { err?: ErrorInfo | ErrnoException | null, responseText?: unknown, headers?: any, - packed?: boolean, + unpacked?: boolean, statusCode?: number ) { let result = false;