Skip to content

Commit

Permalink
Also: update test ports to avoid conflicts in the local system
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrahms committed Sep 20, 2024
1 parent 883344b commit 5bc99b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions server/__tests__/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { JsonRpcClient } from "../../client";
import { Backoff } from "../../client/backoff";
import { testHttpServer } from "../testing/testExpressApp";

const SERVER_RPC_PORT = 8080;
const SERVER_PROXY_PORT = 8081;
const TARGET_PORT = 8082;
const SERVER_RPC_PORT = 18080;
const SERVER_PROXY_PORT = 18081;
const TARGET_PORT = 18082;

type Client = {
jsonRpcClient: JsonRpcClient;
Expand Down Expand Up @@ -78,7 +78,7 @@ describe("Proxy server starts up first", () => {
).resolves.toMatchObject(
expect.objectContaining({
status: 502,
text: "Bad Gateway",
text: '{"error":{"type":"channel_not_found"},"message":"Error: Channel not found: testChannelId"}',
})
);
});
Expand All @@ -89,7 +89,7 @@ describe("Proxy server starts up first", () => {
).resolves.toMatchObject(
expect.objectContaining({
status: 502,
text: "Bad Gateway",
text: '{"error":{},"message":"Error: Client not found: noSuchClientId"}',
})
);
});
Expand Down
6 changes: 3 additions & 3 deletions server/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const httpProxyApp = (
// See See https://nodejs.org/api/stream.html#readablepipedestination-options
stream.pipe(res);
} else {
res.status(response.status).json(response.data);
res.status(response.status).send(response.data);
}
} catch (error: any) {
logger.error({ error, spammy: true }, "Error handling request");
Expand All @@ -89,9 +89,9 @@ export const httpProxyApp = (
(error.message.startsWith("timeout") &&
error.message.endsWith("exceeded"))
) {
res.status(504).json({ error });
res.status(504).json({ error, message: String(error) });
} else {
res.status(502).json({ error });
res.status(502).json({ error, message: String(error) });
}
}
});
Expand Down

0 comments on commit 5bc99b8

Please sign in to comment.