Skip to content

Commit

Permalink
Rename RequestCallback’s packed param to unpacked
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
lawrence-forooghian committed Jul 18, 2023
1 parent 070f2d6 commit 6fae7c2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/common/types/http.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> | null;
Expand Down
2 changes: 1 addition & 1 deletion src/platform/nodejs/lib/util/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/platform/web/lib/transport/fetchrequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) ||
Expand All @@ -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);
}
});
})
Expand Down
2 changes: 1 addition & 1 deletion src/platform/web/lib/util/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6fae7c2

Please sign in to comment.