Skip to content

Commit 7617fc2

Browse files
author
Josh Thomas
committed
Chore: formatting
Signed-off-by: Josh Thomas <jthomas@ignite-retail.com>
1 parent a6bebb2 commit 7617fc2

2 files changed

Lines changed: 13 additions & 15 deletions

File tree

packages/binding-websockets/src/ws-client.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ export default class WebSocketClient implements ProtocolClient {
9696
response = await this.sendRequest(ws, request);
9797

9898
// Extract value from W3C response
99-
const value = (response as Record<string, unknown>).value !== undefined ? (response as Record<string, unknown>).value : response;
99+
const value =
100+
(response as Record<string, unknown>).value !== undefined
101+
? (response as Record<string, unknown>).value
102+
: response;
100103
return new Content(
101104
form.contentType ?? "application/json",
102105
this.bufferToStream(Buffer.from(JSON.stringify(value)))
@@ -169,7 +172,10 @@ export default class WebSocketClient implements ProtocolClient {
169172
response = await this.sendRequest(ws, request);
170173

171174
// Extract output from W3C response
172-
const output = (response as Record<string, unknown>).output !== undefined ? (response as Record<string, unknown>).output : response;
175+
const output =
176+
(response as Record<string, unknown>).output !== undefined
177+
? (response as Record<string, unknown>).output
178+
: response;
173179
return new Content(
174180
form.response?.contentType ?? form.contentType ?? "application/json",
175181
this.bufferToStream(Buffer.from(JSON.stringify(output)))
@@ -549,7 +555,9 @@ export default class WebSocketClient implements ProtocolClient {
549555
const subprotocol = this.extractSubprotocol(form);
550556
const protocols = subprotocol ? [subprotocol] : undefined;
551557

552-
debug(`Creating WebSocket connection to ${form.href}${protocols ? ` with subprotocol ${subprotocol}` : ""}`);
558+
debug(
559+
`Creating WebSocket connection to ${form.href}${protocols ? ` with subprotocol ${subprotocol}` : ""}`
560+
);
553561

554562
// Connect to the full href, not just baseUrl
555563
const ws = new WebSocket(form.href, protocols, wsOptions);

packages/binding-websockets/test/ws-tests.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,7 @@ class WebSocketsTest {
181181
op: "subscribeproperty",
182182
};
183183

184-
const subscription = await client.subscribeResource(
185-
form,
186-
() => {},
187-
undefined,
188-
undefined
189-
);
184+
const subscription = await client.subscribeResource(form, () => {}, undefined, undefined);
190185

191186
// Unsubscribe should trigger the correct operation
192187
await client.unlinkResource(form);
@@ -247,12 +242,7 @@ class WebSocketsTest {
247242
op: "subscribeevent",
248243
};
249244

250-
const subscription = await client.subscribeResource(
251-
form,
252-
() => {},
253-
undefined,
254-
undefined
255-
);
245+
const subscription = await client.subscribeResource(form, () => {}, undefined, undefined);
256246

257247
// Unsubscribe should trigger the correct operation
258248
await client.unlinkResource(form);

0 commit comments

Comments
 (0)