25 lines
988 B
JavaScript
25 lines
988 B
JavaScript
// Metro module 1131 (f1132).
|
|
import { getBodySize, parseContentLengthHeader } from "./Module1132";
|
|
import { dropUndefinedKeys } from "./Module817";
|
|
export function enrichXhrBreadcrumbsForMobileReplay(a0, a1) {
|
|
if (a0.category === "xhr" && a1 && a1.xhr) {
|
|
const r18 = Date.now();
|
|
const { startTimestamp = r18, endTimestamp = r18, input, xhr } = a1;
|
|
a0.data = dropUndefinedKeys({
|
|
start_timestamp: startTimestamp,
|
|
end_timestamp: endTimestamp,
|
|
request_body_size: getBodySize(input),
|
|
response_body_size: xhr.getResponseHeader("content-length") ? parseContentLengthHeader(xhr.getResponseHeader("content-length")) : (function _getBodySize(a0, a1) {
|
|
let bodySize;
|
|
try {
|
|
bodySize = getBodySize(a1 === "json" ? a0 ? typeof a0 === "object" ? JSON.stringify(a0) : a0 : a0 : a0);
|
|
} catch ($e) {
|
|
return void 0;
|
|
}
|
|
return bodySize;
|
|
})(xhr.response, xhr.responseType),
|
|
...a0.data
|
|
});
|
|
}
|
|
}
|