_type: export __export_format: 4 __export_date: 2024-02-13T07:27:17.322Z __export_source: insomnia.desktop.app:v8.6.1 resources: - _id: req_bd8b1eb53418482585b70d0a9616a8cc parentId: wrk_6b9b8455fd784462ae19cd51d7156f86 modified: 1707809216530 created: 1707809085329 url: https://api.insomnia.rest name: Fetch from remote description: "" method: GET body: {} preRequestScript: |- const res = await fetch('https://api.insomnia.rest'); console.log(res) parameters: [] headers: - name: User-Agent value: insomnia/8.6.1 authentication: {} metaSortKey: -1707809028549 isPrivate: false pathParameters: [] settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global _type: request - _id: wrk_6b9b8455fd784462ae19cd51d7156f86 parentId: null modified: 1707808692801 created: 1707808692801 name: Pre-request Scripts description: "" scope: collection _type: workspace - _id: req_244fe815da6c4342a17f0cfd98cf648c parentId: wrk_6b9b8455fd784462ae19cd51d7156f86 modified: 1707809218855 created: 1707808697304 url: http://127.0.0.1:4010/echo name: Long running task description: "" method: GET body: {} preRequestScript: |- function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } async function printAfterDelay() { console.log("Delaying"); await delay(3000); console.log("Delayed"); } await printAfterDelay(); parameters: [] headers: - name: User-Agent value: insomnia/8.6.1 authentication: {} metaSortKey: -1707809028499 isPrivate: false pathParameters: [] settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global _type: request - _id: req_72099fd8f19e47f99554062989302711 parentId: wrk_6b9b8455fd784462ae19cd51d7156f86 modified: 1707809035895 created: 1707809028449 url: http://127.0.0.1:4010/echo name: Range error description: "" method: GET body: {} preRequestScript: let arr = new Array(-1); // Negative length parameters: [] headers: - name: User-Agent value: insomnia/8.6.1 authentication: {} metaSortKey: -1707809028449 isPrivate: false pathParameters: [] settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global _type: request - _id: req_2e524a047e9346b0a0d568f0f82b1568 parentId: wrk_6b9b8455fd784462ae19cd51d7156f86 modified: 1707808953866 created: 1707808727077 url: http://127.0.0.1:4010/echo name: Syntax error description: "" method: GET body: {} preRequestScript: console.log('Hello, world' // Missing closing parenthesis parameters: [] headers: - name: User-Agent value: insomnia/8.6.1 authentication: {} metaSortKey: -1707808727077 isPrivate: false pathParameters: [] settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global _type: request - _id: req_a398a5e19cc74611ae5fc9212980c14c parentId: wrk_6b9b8455fd784462ae19cd51d7156f86 modified: 1707808979424 created: 1707808961112 url: http://127.0.0.1:4010/echo name: Type error description: "" method: GET body: {} preRequestScript: |- let greeting = "Hello, world"; console.log(greetting); // Typo in variable name parameters: [] headers: - name: User-Agent value: insomnia/8.6.1 authentication: {} metaSortKey: -1707808712191 isPrivate: false pathParameters: [] settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global _type: request - _id: req_3084b61cefc0406e965362cccff9f8ce parentId: wrk_6b9b8455fd784462ae19cd51d7156f86 modified: 1707809017110 created: 1707809000715 url: http://127.0.0.1:4010/echo name: Reference error description: "" method: GET body: {} preRequestScript: console.log(foo); // Typo in variable name parameters: [] headers: - name: User-Agent value: insomnia/8.6.1 authentication: {} metaSortKey: -1707808704748 isPrivate: false pathParameters: [] settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global _type: request - _id: env_f9ef1d097c5e00986051fcb4f7a921eea1a86916 parentId: wrk_6b9b8455fd784462ae19cd51d7156f86 modified: 1707808692805 created: 1707808692805 name: Base Environment data: {} dataPropertyOrder: null color: null isPrivate: false metaSortKey: 1707808692805 _type: environment - _id: jar_f9ef1d097c5e00986051fcb4f7a921eea1a86916 parentId: wrk_6b9b8455fd784462ae19cd51d7156f86 modified: 1707808692807 created: 1707808692807 name: Default Jar cookies: [] _type: cookie_jar - _id: fld_01de564274824ecaad272330339ea6b2 parentId: wrk_6b9b8455fd784462ae19cd51d7156f86 modified: 1668533312225 created: 1668533312225 name: FolderWithEnv description: "" environment: customValue: "fromFolder" environmentPropertyOrder: null metaSortKey: -1668533312225 _type: request_group - _id: req_89dade2ee9ee42fbb22d588783a9df3c parentId: fld_01de564274824ecaad272330339ea6b2 modified: 1636707449231 created: 1636141014552 url: http://127.0.0.1:4010/echo name: echo pre-request script result description: "" method: POST body: {} parameters: [] headers: [] authentication: {} metaSortKey: -1636141014553 isPrivate: false settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global _type: request - _id: req_89dade2ee9ee42fbb22d588783a9df3d parentId: fld_01de564274824ecaad272330339ea6b2 modified: 1636707449231 created: 1636141014552 url: http://127.0.0.1:4010/echo name: test certificate manipulation description: "" method: POST body: {} parameters: [] headers: [] authentication: {} metaSortKey: -1636141014553 isPrivate: false settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global preRequestScript: |- // print the original one console.log('key:', insomnia.request.certificate.key.src); console.log('cert:', insomnia.request.certificate.cert.src); console.log('passphrass:', insomnia.request.certificate.passphrass); console.log('pfx:', insomnia.request.certificate.pfx.src); // update insomnia.request.certificate.update({ disabled: true, key: {src: 'invalid.key'}, cert: {src: 'invalid.cert'}, passphrase: '', pfx: {src: ''}, }); _type: request - _id: req_89dade2ee9ee42fbb22d588783a9df3e parentId: fld_01de564274824ecaad272330339ea6b2 modified: 1636707449231 created: 1636141014552 url: http://127.0.0.1:4010/echo name: test proxies manipulation description: "" method: POST body: {} parameters: [] headers: [] authentication: {} metaSortKey: -1636141014553 isPrivate: false settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global preRequestScript: |- console.log(insomnia.request.proxy.getProxyUrl()); insomnia.request.proxy.update({ host: 'localhost', match: '', port: 8888, tunnel: false, authenticate: false, username: '', password: '', }); _type: request - _id: req_89dade2ee9ee42fbb22d588783a9df00 parentId: fld_01de564274824ecaad272330339ea6b2 modified: 1636707449231 created: 1636141014552 url: http://127.0.0.1:4010/echo name: environments setting and overriding description: "" method: POST parameters: [] headers: - name: 'Content-Type' value: 'application/json' authentication: {} metaSortKey: -1636141014553 isPrivate: false settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global preRequestScript: |- insomnia.baseEnvironment.set('fromBaseEnv', 'baseEnv'); insomnia.baseEnvironment.set('scriptValue', 'fromBase'); insomnia.environment.set('scriptValue', 'fromEnv'); // "preDefinedValue" is already defined in the base environment modal. // but it is rewritten here insomnia.baseEnvironment.set('preDefinedValue', 'fromScript'); // "customValue" is already defined in the folder environment. // folder version will override the following one insomnia.baseEnvironment.set('customValue', 'fromScript'); body: mimeType: "application/json" text: |- { "fromBaseEnv": "{{ _.fromBaseEnv }}", "scriptValue": "{{ _.scriptValue }}", "preDefinedValue": "{{ _.preDefinedValue }}", "customValue": "{{ _.customValue }}" } _type: request - _id: req_89dade2ee9ee42fbb22d588783a9df01 parentId: fld_01de564274824ecaad272330339ea6b2 modified: 1636707449231 created: 1636141014552 url: http://127.0.0.1:4010/echo name: variables / manipulate variables and set them to environment description: "" method: POST parameters: [] headers: - name: 'Content-Type' value: 'application/json' authentication: {} metaSortKey: -1636141014553 isPrivate: false settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global preRequestScript: |- // set local pm.variables.set('varStr', 'varStr'); pm.variables.set('varNum', 777); pm.variables.set('varBool', true); // has pm.environment.set('varStr', pm.variables.get('varStr')); pm.environment.set('varNum', pm.variables.get('varNum')); pm.environment.set('varBool', pm.variables.get('varBool')); body: mimeType: "application/json" text: |- { "varStr": "{{ _.varStr }}", "varNum": {{ _.varNum }}, "varBool": {{ _.varBool }} } _type: request - _id: req_89dade2ee9ee42fbb22d588783a9df02 parentId: fld_01de564274824ecaad272330339ea6b2 modified: 1636707449231 created: 1636141014552 url: http://127.0.0.1:4010/echo name: require / require classes from insomnia-collection module and init them description: "" method: POST parameters: [] headers: - name: 'Content-Type' value: 'application/json' authentication: {} metaSortKey: -1636141014553 isPrivate: false settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global preRequestScript: |- const { Property, Header, Variable, QueryParam, Url, RequestAuth, ProxyConfig, Cookie, Certificate, RequestBody, Request, Response } = require('insomnia-collection'); const prop = new Property('pid', 'pname'); const header = new Header({ key: 'headerKey', value: 'headerValue' }); const variable = new Variable({ key: 'headerKey', value: 'headerValue' }); const qParam = new QueryParam({ key: 'queryKey', value: 'queryValue' }); const url = new Url({ host: ['insomnia', 'rest'], path: ['path1', 'path2'], protocol: 'https', }); const proxyConfig = new ProxyConfig({ match: 'http+https://*.example.com:80/*', host: 'proxy.com', port: 8080, tunnel: true, disabled: false, authenticate: true, username: 'proxy_username', password: 'proxy_password', }); const reqAuth = new RequestAuth({ type: 'basic', basic: [ { key: 'username', value: 'user1' }, { key: 'password', value: 'pwd1' }, ], }); const cookie = new Cookie({ key: 'queryKey', value: 'queryValue' }); const cert = new Certificate({ name: 'Certificate for example.com', matches: ['https://example.com'], key: { src: '/User/path/to/certificate/key' }, cert: { src: '/User/path/to/certificate' }, passphrase: 'iampassphrase', }); const reqBody = new RequestBody({ mode: 'urlencoded', urlencoded: [ { key: 'urlencodedKey', value: 'urlencodedValue' }, ], options: {}, }); const req = new Request({ url: 'https://hostname.com/path', method: 'GET', header: [ { key: 'header1', value: 'val1' }, { key: 'header2', value: 'val2' }, ], body: { mode: 'raw', raw: 'body content', }, auth: { type: 'basic', basic: [ { key: 'username', value: 'myname' }, { key: 'password', value: 'mypwd' }, ], }, proxy: undefined, certificate: undefined, }); const resp = new Response({ code: 200, reason: 'OK', header: [ { key: 'header1', value: 'val1' }, { key: 'header2', value: 'val2' }, { key: 'Content-Length', value: '100' }, { key: 'Content-Disposition', value: 'attachment; filename="filename.txt"' }, { key: 'Content-Type', value: 'text/plain; charset=utf-8' }, ], cookie: [ { key: 'header1', value: 'val1' }, { key: 'header2', value: 'val2' }, ], body: '{"key": 888}', stream: undefined, responseTime: 100, status: 'OK', originalRequest: req, }); // set part of values insomnia.environment.set('propJson', JSON.stringify(prop.toJSON())); insomnia.environment.set('headerJson', JSON.stringify(header.toJSON())); body: mimeType: "application/json" text: |- { "propJson": {{ _.propJson }}, "headerJson": {{ _.headerJson }} } _type: request - _id: req_89dade2ee9ee42fbb22d588783a9df03 parentId: fld_01de564274824ecaad272330339ea6b2 modified: 1636707449231 created: 1636141014552 url: http://127.0.0.1:4010/echo name: insomnia.request manipulation description: "" method: POST parameters: [] headers: - name: 'Content-Type' value: 'application/json' authentication: {} metaSortKey: -1636141014553 isPrivate: false settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global preRequestScript: |- const { Header } = require('insomnia-collection'); insomnia.request.method = 'GET'; insomnia.request.url.addQueryParams('k1=v1'); insomnia.request.headers.add(new Header({ key: 'Content-Type', value: 'text/plain' })); insomnia.request.headers.add(new Header({ key: 'X-Hello', value: 'hello' })); insomnia.request.body.update({ mode: 'raw', raw: 'rawContent', }); body: mimeType: "application/json" text: |- {} _type: request - _id: req_89dade2ee9ee42fbb22d588783a9df05 parentId: fld_01de564274824ecaad272330339ea6b2 modified: 1636707449231 created: 1636141014552 url: http://127.0.0.1:4010/echo name: insomnia.request auth manipulation (bearer) description: "" method: POST parameters: [] headers: - name: 'Content-Type' value: 'application/json' authentication: {} metaSortKey: -1636141014553 isPrivate: false settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global preRequestScript: |- insomnia.request.auth.update( { type: 'bearer', bearer: [ {key: 'token', value: 'tokenValue'}, {key: 'prefix', value: 'CustomTokenPrefix'}, ], }, 'bearer' ); body: mimeType: "application/json" text: '{}' _type: request - _id: req_89dade2ee9ee42fbb22d588783a9df06 parentId: fld_01de564274824ecaad272330339ea6b2 modified: 1636707449231 created: 1636141014552 url: http://127.0.0.1:4010/echo name: insomnia.request auth manipulation (basic) description: "" method: POST parameters: [] headers: - name: 'Content-Type' value: 'application/json' authentication: {} metaSortKey: -1636141014553 isPrivate: false settingStoreCookies: true settingSendCookies: true settingDisableRenderRequestBody: false settingEncodeUrl: true settingRebuildPath: true settingFollowRedirects: global preRequestScript: |- insomnia.request.auth.update( { type: 'basic', basic: [ {key: 'username', value: 'myName'}, {key: 'password', value: 'myPwd'}, ], }, 'basic' ); body: mimeType: "application/json" text: '{}' _type: request