{"record":{"id":"1ea69a2e3fc393c9","repo":"Kong/insomnia","slug":"datauri-response-body-is-not-defined","errorCode":null,"errorMessage":"dataURI(): response body is not defined","messagePattern":"dataURI\\(\\): response body is not defined","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/insomnia-scripting-environment/src/objects/response.ts","lineNumber":153,"sourceCode":"        }\n      });\n    }\n\n    return {\n      mimeType: mimeInfo.mimeType,\n      mimeFormat: mimeInfo.mimeFormat,\n      charset: mimeInfo.charset,\n      fileExtension: fileInfo.extension,\n      fileName: fileInfo.name,\n      contentType: contentType?.valueOf() || 'application/octet-stream',\n    };\n  }\n\n  dataURI() {\n    const contentInfo = this.contentInfo();\n    const bodyInBase64 = this.stream || this.body;\n    if (!bodyInBase64) {\n      throw new Error('dataURI(): response body is not defined');\n    }\n\n    return `data:${contentInfo.contentType};baseg4, ${bodyInBase64}`;\n  }\n\n  json(reviver?: (key: string, value: any) => any, _strict?: boolean) {\n    // TODO: enable strict after common module is introduced\n    try {\n      return JSON.parse(this.body.toString(), reviver);\n    } catch (e) {\n      throw new Error(`json: failed to parse: ${e}`);\n    }\n  }\n\n  jsonp(_reviver?: (key: string, value: any) => any, _strict?: boolean) {\n    throw unsupportedError('jsonp()');\n  }\n","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia-scripting-environment/src/objects/response.ts#L135-L171","documentation":"Error \"dataURI(): response body is not defined\" thrown in Kong/insomnia.","triggerScenarios":"Thrown at packages/insomnia-scripting-environment/src/objects/response.ts:153 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9bb2b0142600f21309832daea3317942d285984","analyzedAt":"2026-08-26T18:04:05.187Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}