Skip to content

Add serializeEnvelope transport option #6342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/core/src/transports/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ export function createTransport(
});
};

const _serializeEnvelope = options.serializeEnvelope || serializeEnvelope;

const requestTask = (): PromiseLike<void> =>
makeRequest({ body: serializeEnvelope(filteredEnvelope, options.textEncoder) }).then(
makeRequest({ body: _serializeEnvelope(filteredEnvelope, options.textEncoder) }).then(
response => {
// We don't want to throw on NOK responses, but we want to at least log them
if (response.statusCode !== undefined && (response.statusCode < 200 || response.statusCode >= 300)) {
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface InternalBaseTransportOptions {
bufferSize?: number;
recordDroppedEvent: Client['recordDroppedEvent'];
textEncoder?: TextEncoderInternal;
serializeEnvelope?: (envelope: Envelope, textEncoder?: TextEncoderInternal) => string | Uint8Array;
}

export interface BaseTransportOptions extends InternalBaseTransportOptions {
Expand Down