@@ -206,10 +206,20 @@ function extractUserData(
206206 return user ;
207207}
208208
209+ /**
210+ * Options deciding what parts of the request to use when enhancing an event
211+ */
212+ interface ParseRequestOptions {
213+ request ?: boolean | string [ ] ;
214+ serverName ?: boolean ;
215+ transaction ?: boolean | TransactionTypes ;
216+ user ?: boolean | string [ ] ;
217+ version ?: boolean ;
218+ }
219+
209220/**
210221 * Enriches passed event with request data.
211222 *
212- *
213223 * @param event Will be mutated and enriched with req data
214224 * @param req Request object
215225 * @param options object containing flags to enable functionality
@@ -220,13 +230,7 @@ export function parseRequest(
220230 req : {
221231 [ key : string ] : any ;
222232 } ,
223- options ?: {
224- request ?: boolean | string [ ] ;
225- serverName ?: boolean ;
226- transaction ?: boolean | TransactionTypes ;
227- user ?: boolean | string [ ] ;
228- version ?: boolean ;
229- } ,
233+ options ?: ParseRequestOptions ,
230234) : Event {
231235 // tslint:disable-next-line:no-parameter-reassignment
232236 options = {
@@ -277,14 +281,11 @@ export function parseRequest(
277281 * Express compatible request handler.
278282 * @see Exposed as `Handlers.requestHandler`
279283 */
280- export function requestHandler ( options ?: {
281- request ?: boolean ;
282- serverName ?: boolean ;
283- transaction ?: boolean | TransactionTypes ;
284- user ?: boolean | string [ ] ;
285- version ?: boolean ;
286- flushTimeout ?: number ;
287- } ) : ( req : http . IncomingMessage , res : http . ServerResponse , next : ( error ?: any ) => void ) => void {
284+ export function requestHandler (
285+ options ?: ParseRequestOptions & {
286+ flushTimeout ?: number ;
287+ } ,
288+ ) : ( req : http . IncomingMessage , res : http . ServerResponse , next : ( error ?: any ) => void ) => void {
288289 return function sentryRequestMiddleware (
289290 req : http . IncomingMessage ,
290291 res : http . ServerResponse ,
0 commit comments