spot: update network proxy for auto sanitizer

This commit is contained in:
nick-delirium 2025-03-25 14:52:21 +01:00 committed by Delirium
parent 1e57c90449
commit 4cf688f15c
2 changed files with 5 additions and 8 deletions

View file

@ -17,7 +17,7 @@
},
"dependencies": {
"@neodrag/solid": "^2.2.0",
"@openreplay/network-proxy": "^1.0.5",
"@openreplay/network-proxy": "^1.1.0",
"@thedutchcoder/postcss-rem-to-px": "^0.0.2",
"autoprefixer": "^10.4.19",
"install": "^0.13.0",

View file

@ -1,9 +1,6 @@
import createNetworkProxy, { INetworkMessage } from "@openreplay/network-proxy";
import {
SpotNetworkRequest,
filterBody,
filterHeaders,
tryFilterUrl,
getTopWindow,
} from "./networkTrackingUtils";
@ -36,7 +33,7 @@ function getBody(req: { body?: string | Record<string, any> }): string {
if (req.body) {
try {
body = filterBody(req.body);
body = req.body;
} catch (e) {
body = "Error parsing body";
console.error(e);
@ -63,8 +60,8 @@ export function createSpotNetworkRequest(
} catch (e) {
console.error("Error parsing response", e);
}
const reqHeaders = request.headers ? filterHeaders(request.headers) : {};
const resHeaders = response.headers ? filterHeaders(response.headers) : {};
const reqHeaders = request.headers ?? {};
const resHeaders = response.headers ?? {};
const responseBodySize = msg.responseSize || 0;
const reqSize = msg.request ? msg.request.length : 0;
const body = getBody(request);
@ -81,7 +78,7 @@ export function createSpotNetworkRequest(
timestamp: Date.now(),
statusCode: msg.status || 0,
error: undefined,
url: tryFilterUrl(msg.url),
url: msg.url,
fromCache: false,
encodedBodySize: reqSize,
responseBodySize,