Skip to content

Commit f6b93a7

Browse files
committed
use express handler request data options from sdkProcessingMetadata if available
1 parent 9d14753 commit f6b93a7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/node/src/integrations/requestdata.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,22 @@ export class RequestData implements Integration {
108108
addGlobalEventProcessor(event => {
109109
const hub = getCurrentHub();
110110
const self = hub.getIntegration(RequestData);
111-
const req = event.sdkProcessingMetadata && event.sdkProcessingMetadata.request;
111+
112+
const { sdkProcessingMetadata = {} } = event;
113+
const req = sdkProcessingMetadata.request;
112114

113115
// If the globally installed instance of this integration isn't associated with the current hub, `self` will be
114116
// undefined
115117
if (!self || !req) {
116118
return event;
117119
}
118120

119-
const addRequestDataOptions = convertReqDataIntegrationOptsToAddReqDataOpts(this._options);
121+
// The Express request handler takes a similar `include` option to that which can be passed to this integration.
122+
// If passed there, we store it in `sdkProcessingMetadata`. TODO(v8): Force express people to use this
123+
// integration, so that all of this passing and conversion isn't necessary
124+
const addRequestDataOptions =
125+
sdkProcessingMetadata.requestDataOptionsFromExpressHandler ||
126+
convertReqDataIntegrationOptsToAddReqDataOpts(this._options);
120127

121128
const processedEvent = this._addRequestData(event, req, addRequestDataOptions);
122129

0 commit comments

Comments
 (0)