1
1
import {
2
2
Context ,
3
3
ServerlessCallback ,
4
+ ServerlessEventObject ,
4
5
ServerlessFunctionSignature ,
5
6
TwilioClient ,
6
7
TwilioClientOptions ,
@@ -17,6 +18,10 @@ import { join, resolve } from 'path';
17
18
import { deserializeError } from 'serialize-error' ;
18
19
import { checkForValidAccountSid } from './checks/check-account-sid' ;
19
20
import { checkForValidAuthToken } from './checks/check-auth-token' ;
21
+ import {
22
+ restrictedHeaderExactMatches ,
23
+ restrictedHeaderPrefixes ,
24
+ } from './checks/restricted-headers' ;
20
25
import { Reply } from './internal/functionRunner' ;
21
26
import { Response } from './internal/response' ;
22
27
import * as Runtime from './internal/runtime' ;
@@ -25,10 +30,6 @@ import debug from './utils/debug';
25
30
import { wrapErrorInHtml } from './utils/error-html' ;
26
31
import { requireFromProject } from './utils/requireFromProject' ;
27
32
import { cleanUpStackTrace } from './utils/stack-trace/clean-up' ;
28
- import {
29
- restrictedHeaderPrefixes ,
30
- restrictedHeaderExactMatches ,
31
- } from './checks/restricted-headers' ;
32
33
33
34
const log = debug ( 'twilio-runtime-handler:dev:route' ) ;
34
35
@@ -75,7 +76,9 @@ export function constructHeaders(rawHeaders?: string[]): Headers {
75
76
return { } ;
76
77
}
77
78
78
- export function constructEvent < T extends { } = { } > ( req : ExpressRequest ) : T {
79
+ export function constructEvent < T extends ServerlessEventObject > (
80
+ req : ExpressRequest
81
+ ) : T {
79
82
return {
80
83
request : {
81
84
headers : constructHeaders ( req . rawHeaders ) ,
0 commit comments