11import {
22 Context ,
33 ServerlessCallback ,
4+ ServerlessEventObject ,
45 ServerlessFunctionSignature ,
56 TwilioClient ,
67 TwilioClientOptions ,
@@ -17,6 +18,10 @@ import { join, resolve } from 'path';
1718import { deserializeError } from 'serialize-error' ;
1819import { checkForValidAccountSid } from './checks/check-account-sid' ;
1920import { checkForValidAuthToken } from './checks/check-auth-token' ;
21+ import {
22+ restrictedHeaderExactMatches ,
23+ restrictedHeaderPrefixes ,
24+ } from './checks/restricted-headers' ;
2025import { Reply } from './internal/functionRunner' ;
2126import { Response } from './internal/response' ;
2227import * as Runtime from './internal/runtime' ;
@@ -25,10 +30,6 @@ import debug from './utils/debug';
2530import { wrapErrorInHtml } from './utils/error-html' ;
2631import { requireFromProject } from './utils/requireFromProject' ;
2732import { cleanUpStackTrace } from './utils/stack-trace/clean-up' ;
28- import {
29- restrictedHeaderPrefixes ,
30- restrictedHeaderExactMatches ,
31- } from './checks/restricted-headers' ;
3233
3334const log = debug ( 'twilio-runtime-handler:dev:route' ) ;
3435
@@ -75,7 +76,9 @@ export function constructHeaders(rawHeaders?: string[]): Headers {
7576 return { } ;
7677}
7778
78- export function constructEvent < T extends { } = { } > ( req : ExpressRequest ) : T {
79+ export function constructEvent < T extends ServerlessEventObject > (
80+ req : ExpressRequest
81+ ) : T {
7982 return {
8083 request : {
8184 headers : constructHeaders ( req . rawHeaders ) ,
0 commit comments