Skip to content

Commit

Permalink
test(server): fix SSE test
Browse files Browse the repository at this point in the history
  • Loading branch information
Falinor committed Jun 11, 2024
1 parent ed84123 commit f7e5fb2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions server/src/controllers/serverSentEventController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function handle(request: Request, response: Response): void {
const headers = {
'Content-Type': 'text/event-stream',
Connection: 'keep-alive',
'Cache-Control': 'no-cache',
'Cache-Control': 'no-cache'
};
response.writeHead(constants.HTTP_STATUS_OK, headers);

Expand All @@ -18,6 +18,7 @@ function handle(request: Request, response: Response): void {
logger.info('Queue event received', data);
response.write(`event: ${job}\n`);
response.write(`data: ${JSON.stringify(data)}\n\n`);
response.end();
});
});

Expand All @@ -27,5 +28,5 @@ function handle(request: Request, response: Response): void {
}

export default {
handle,
handle
};
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ describe('Server-sent event API', () => {
`data: ${JSON.stringify({ id: campaign.id })}\n\n`
);
callback(null, response);
done();
});
});
} catch (error) {
Expand Down

0 comments on commit f7e5fb2

Please sign in to comment.