Skip to content

Commit d0cc1f9

Browse files
alexluckettdavidjamesstone
authored andcommitted
Set timeout for page events to 5 seconds
1 parent 690877b commit d0cc1f9

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/server/plugins/engine/routes/questions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async function handleHttpEvent(
6363

6464
// @ts-expect-error - function signature will be refactored in the next iteration of the formatter
6565
const payload = format(context, items, model, undefined, undefined)
66-
const opts = { payload }
66+
const opts: httpService.RequestOptions = { payload, timeout: 5000 }
6767

6868
if (preparePageEventRequestOptions) {
6969
preparePageEventRequestOptions(opts, event, page, context)

test/form/plugin-options.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('Plugin options - page events', () => {
5151

5252
expect(httpService.postJson).toHaveBeenCalledExactlyOnceWith(
5353
'http://example.com',
54-
{ payload: expect.any(String) }
54+
{ payload: expect.any(String), timeout: 5000 }
5555
)
5656
})
5757
})
@@ -97,7 +97,7 @@ describe('Plugin options - page events with preparePageEventRequestOptions', ()
9797
})
9898

9999
expect(preparePageEventRequestOptions).toHaveBeenCalledExactlyOnceWith(
100-
{ payload: expect.any(String) },
100+
{ payload: expect.any(String), timeout: 5000 },
101101
{
102102
type: 'http',
103103
options: {
@@ -111,7 +111,7 @@ describe('Plugin options - page events with preparePageEventRequestOptions', ()
111111

112112
expect(httpService.postJson).toHaveBeenCalledExactlyOnceWith(
113113
'http://example.com',
114-
{ payload: expect.any(String) }
114+
{ payload: expect.any(String), timeout: 5000 }
115115
)
116116
})
117117
})

0 commit comments

Comments
 (0)