@@ -206,10 +206,20 @@ function extractUserData(
206
206
return user ;
207
207
}
208
208
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
+
209
220
/**
210
221
* Enriches passed event with request data.
211
222
*
212
- *
213
223
* @param event Will be mutated and enriched with req data
214
224
* @param req Request object
215
225
* @param options object containing flags to enable functionality
@@ -220,13 +230,7 @@ export function parseRequest(
220
230
req : {
221
231
[ key : string ] : any ;
222
232
} ,
223
- options ?: {
224
- request ?: boolean | string [ ] ;
225
- serverName ?: boolean ;
226
- transaction ?: boolean | TransactionTypes ;
227
- user ?: boolean | string [ ] ;
228
- version ?: boolean ;
229
- } ,
233
+ options ?: ParseRequestOptions ,
230
234
) : Event {
231
235
// tslint:disable-next-line:no-parameter-reassignment
232
236
options = {
@@ -277,14 +281,11 @@ export function parseRequest(
277
281
* Express compatible request handler.
278
282
* @see Exposed as `Handlers.requestHandler`
279
283
*/
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 {
288
289
return function sentryRequestMiddleware (
289
290
req : http . IncomingMessage ,
290
291
res : http . ServerResponse ,
0 commit comments