Skip to content

Commit 76b8b91

Browse files
committed
clarify envelope comments
1 parent dd215ec commit 76b8b91

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

packages/core/src/request.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,25 @@ export function transactionToSentryRequest(event: Event, api: API): SentryReques
6060
const itemHeaders = JSON.stringify({
6161
type: event.type,
6262

63-
// TODO: Right now, sampleRate won't be defined in the cases of inheritance and explicitly-set sampling decisions.
63+
// TODO: Right now, sampleRate will be undefined in the cases of inheritance and explicitly-set sampling decisions.
6464
sample_rates: [{ id: samplingMethod, rate: sampleRate }],
6565

66-
// The content-type is assumed to be 'application/json' and not part of
67-
// the current spec for transaction items, so we don't bloat the request
68-
// body with it.
66+
// Note: `content_type` and `length` were left out on purpose. Here's a quick explanation of why, along with the
67+
// value to use if we ever decide to put them back in.
6968
//
69+
// `content_type`:
70+
// Assumed to be 'application/json' and not part of the current spec for transaction items. No point in bloating the
71+
// request body with it.
72+
//
73+
// would be:
7074
// content_type: 'application/json',
7175
//
72-
// The length is optional. It must be the number of bytes in req.Body
73-
// encoded as UTF-8. Since the server can figure this out and would
74-
// otherwise refuse events that report the length incorrectly, we decided
75-
// not to send the length to avoid problems related to reporting the wrong
76-
// size and to reduce request body size.
76+
// `length`:
77+
// Optional and equal to the number of bytes in req.Body encoded as UTF-8. Since the server can figure this out and
78+
// would otherwise refuse events that report the length incorrectly, we decided not to send the length to avoid
79+
// problems related to reporting the wrong size and to reduce request body size.
7780
//
81+
// would be:
7882
// length: new TextEncoder().encode(req.body).length,
7983
});
8084

0 commit comments

Comments
 (0)