UNPKG

insomnia-importers

Version:

Various data importers for Insomnia

49 lines 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.unthrowableParseJson = exports.setDefaults = void 0; const setDefaults = (obj) => { if (!obj || !obj._type) { return obj; } switch (obj._type) { case 'request': return { parentId: '__WORKSPACE_ID__', name: 'Imported', url: '', body: '', parameters: [], headers: [], authentication: {}, ...obj, method: (obj.method || 'GET').toUpperCase(), }; case 'request_group': return { parentId: '__WORKSPACE_ID__', name: 'Imported', environment: {}, ...obj, }; case 'environment': return { parentId: '__BASE_ENVIRONMENT_ID__', name: 'Imported Environment', data: {}, ...obj, }; default: return obj; } }; exports.setDefaults = setDefaults; const unthrowableParseJson = (rawData) => { try { return JSON.parse(rawData); } catch (err) { return null; } }; exports.unthrowableParseJson = unthrowableParseJson; //# sourceMappingURL=utils.js.map