Fix Insomnia v5 importer

This commit is contained in:
Gregory Schier
2025-05-20 08:08:56 -07:00
parent c73f0b02bd
commit 2c3fb25932
4 changed files with 162 additions and 2 deletions

View File

@@ -75,7 +75,7 @@ function importHttpRequest(
let bodyType: string | null = null;
let body = {};
if (r.body.mimeType === 'application/octet-stream') {
if (r.body?.mimeType === 'application/octet-stream') {
bodyType = 'binary';
body = { filePath: r.body.fileName ?? '' };
} else if (r.body?.mimeType === 'application/x-www-form-urlencoded') {
@@ -256,7 +256,7 @@ function importEnvironment(e: any, workspaceId: string, isParent?: boolean): Par
base: isParent ?? e.parentId === workspaceId,
model: 'environment',
name: e.name,
variables: Object.entries(e.data).map(([name, value]) => ({
variables: Object.entries(e.data ?? {}).map(([name, value]) => ({
enabled: true,
name,
value: `${value}`,