@@ -60,21 +60,25 @@ export function transactionToSentryRequest(event: Event, api: API): SentryReques
60
60
const itemHeaders = JSON . stringify ( {
61
61
type : event . type ,
62
62
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.
64
64
sample_rates : [ { id : samplingMethod , rate : sampleRate } ] ,
65
65
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.
69
68
//
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:
70
74
// content_type: 'application/json',
71
75
//
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.
77
80
//
81
+ // would be:
78
82
// length: new TextEncoder().encode(req.body).length,
79
83
} ) ;
80
84
0 commit comments