Reconcile secureReadFile changes with reverted mock response extractor changes

This commit is contained in:
Vivek Thuravupala
2025-10-09 18:54:51 -07:00
parent a9d1a4b425
commit f517bfccd8

View File

@@ -140,7 +140,7 @@ If you want to create a self-hosted mock server route from a request response in
label: 'Name',
onComplete: async name => {
invariant(activeResponse, 'Active response must be defined');
const body = 'bodyPath' in activeResponse ? await fs.readFile(activeResponse.bodyPath) : '';
const body = 'bodyPath' in activeResponse ? await window.main.secureReadFile({ path: activeResponse.bodyPath }) : '';
// auth mechanism is too sensitive to allow content length checks
const headersWithoutContentLength: ResponseHeader[] = activeResponse.headers.filter(
h => h.name.toLowerCase() !== 'content-length',
@@ -171,7 +171,7 @@ If you want to create a self-hosted mock server route from a request response in
label: 'Name',
onComplete: async name => {
invariant(activeResponse, 'Active response must be defined');
const body = 'bodyPath' in activeResponse ? await fs.readFile(activeResponse.bodyPath) : '';
const body = 'bodyPath' in activeResponse ? await window.main.secureReadFile({ path: activeResponse.bodyPath }) : '';
const hasRouteInServer = mockServerAndRoutes
.find(s => s._id === selectedMockServer)
?.routes.find(r => r.name === name && r.method.toUpperCase() === 'GET');