Comments (2)
Hello!
Really sorry for the delay! I'll try to come up with a good strategy for this in the coming days.
from insomnia-documenter.
Hi,
Just started using the documentor - really pleased with the results so far - thanks!
However, I seem to have hit the same issue - I use environment variables in the body part of a post request, like this:
{
"email": "_.email",
"password": "_.password",
"strategy": "couch"
}
Which results in the insomnia export file containing data like this:
"method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"email\": \"{{ _.email }}\",\n\t\"password\": \"{{_.password}}\",\n\t\"strategy\": \"couch\"\n}"}
This causes an error whilst loading the file of:
SyntaxError: JSON.parse: expected ',' or '}' after property value in object at line 2 column 13 of the JSON data
Note that whilst I enter _.email, it still resolves to {{_.email}}
- I can use {{email}}, which of course resolves to {{email}} which has the same issue.
Experimenting, I found that by swapping {{_.email}} with \u007B\u007B _.email \u007D \u007D
although - if you notice, there is a space between the last 2 hex codes....take the space out and you get an error again!!!
I've not bothered whether the {{ }} appear in the docs or not - I think that naming the vars better on my part will make the docs work - like:
{
"email": "_.users_email",
"password": "_.users_password",
"strategy": "couch"
}
so all that remains is to get rid of the {{ }} in the insomnia.json file, or replace them... I used a small script to rewrite the export file, before moving to the web site:
var fs = require('fs')
fs.readFile('insomnia.json', 'utf8', (err, data) => {
if (err) { return console.log(err); }
var str = data.replace(/{{ _\.(\w+) }}/g, "\\u007B\\u007B _.$1 \\u007D \\u007D");
fs.writeFile('insomnia.json', str, 'utf8', (err) => {
if (err) { return console.log(err); }
});
});
Hope that helps someone....
....if you are able to patch something similar, that would be great.
from insomnia-documenter.
Related Issues (20)
- Error displaying app HOT 14
- Python request display HOT 1
- cannot access insomnia,json HOT 2
- For support use Discussions, for bug reports use Issues! HOT 4
- Option to not include cookies in documentation
- JSON.parse SyntaxError since 0.4.4 HOT 6
- Environment not working HOT 2
- Error in export Json V4 HOT 1
- Push commit to npm HOT 1
- Documentation show error "TypeError: e is null" HOT 2
- FormatEnv function throws an error when url for some requests are empty
- Add `overflow: auto` to description css class
- Example response not parsed HOT 2
- Github Pages Deployment steps
- Example response not working HOT 13
- Raw content data support. HOT 2
- Converting to Static Site
- Auto Expand Menu HOT 1
- Display info.description
- Demo Page 404 on README.md HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from insomnia-documenter.