Skip to content
Merged
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
6 changes: 5 additions & 1 deletion packages/browser/src/BacktraceBrowserRequestHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ export class BacktraceBrowserRequestHandler implements BacktraceRequestHandler {
private readonly _timeout: number;
private readonly JSON_HEADERS = {
'Content-type': 'application/json',
'Transfer-Encoding': 'chunked',
};

private readonly MULTIPART_HEADERS = {
'Transfer-Encoding': 'chunked',
};
constructor(
private readonly _options: {
url: string;
Expand Down Expand Up @@ -45,7 +49,7 @@ export class BacktraceBrowserRequestHandler implements BacktraceRequestHandler {
const response = await fetch(submissionUrl, {
method: 'POST',
body: payload,
headers: typeof payload === 'string' ? this.JSON_HEADERS : {},
headers: typeof payload === 'string' ? this.JSON_HEADERS : this.MULTIPART_HEADERS,
signal: anySignal(abortSignal, controller.signal),
});

Expand Down
10 changes: 9 additions & 1 deletion packages/node/src/BacktraceNodeRequestHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export class BacktraceNodeRequestHandler implements BacktraceRequestHandler {

private readonly JSON_HEADERS = {
'Content-type': 'application/json',
'Transfer-Encoding': 'chunked',
};

private readonly MULTIPART_HEADERS = {
'Transfer-Encoding': 'chunked',
};

constructor(
Expand Down Expand Up @@ -63,7 +68,10 @@ export class BacktraceNodeRequestHandler implements BacktraceRequestHandler {
rejectUnauthorized: this._options.ignoreSslCertificate === true,
timeout: this._timeout,
method: 'POST',
headers: typeof payload === 'string' ? this.JSON_HEADERS : payload.getHeaders(),
headers:
typeof payload === 'string'
? this.JSON_HEADERS
: { ...payload.getHeaders(), ...this.MULTIPART_HEADERS },
},
(response) => {
let result = '';
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/src/ReactNativeRequestHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class ReactNativeRequestHandler implements BacktraceRequestHandler {
private readonly _timeout: number;
private readonly JSON_HEADERS = {
'Content-type': 'application/json',
'Transfer-Encoding': 'chunked',
};
private readonly MULTIPART_HEADERS = {
'Transfer-Encoding': 'chunked',
Expand Down