jonaslu / ain Goto Github PK
View Code? Open in Web Editor NEWA HTTP API client for the terminal
License: MIT License
A HTTP API client for the terminal
License: MIT License
In the [Body]
section, I'm passing a JSON object with these details:
{
"email": "[email protected]",
"password": "0x143#",
"user_type": "tenant"
}
ain
interprets #
part of the password
field as the start of a comment, resulting in this body instead:
{
"email": "[email protected]",
"password": "0x143
"user_type": "tenant"
}
This is causing the request to fail because the resulting body is not valid JSON.
The regex ends at the first )
making anything containing parenthesis fail:
E g
bash -c 'cat <(echo yo)')
- will fail on unterminated escape sequence because the matched executable regex will be this:
bash -c 'cat <(echo yo
Hi. hope you are fine. :)
Is there a way to run the same query on multiple endpoint for example:
curl -XDELETE http://elastisearch.local/index_1
curl -XDELETE http://elastisearch.local/index_2
curl -XDELETE http://elastisearch.local/index_3
btw. thank you for this awesome tool.
Go releaser supports snapcraft builds, so why not do that?
I gave this a try for some elasticsearch querying work but couldn't find anything that'd let me do response processing.
For simple stuff I can pipe to jq just fine, but it might be nice to be able to encode something like jq .hits.total.value
into the ain file to get just that portion of the response, or indented JSON response output.
If it's there and I missed it let me know, but seems like for now pipe is the only option.
Instead of having to run something like
ain base.ain some-request.ain
it would be good to be able to specify the base in the .ain
file as a block.
Then we could simply run
ain some-request.ain
I am imagining the template would look something like this
[Base]
base.ain (or potentially path to the file)
[Host]
/api/blog/create
[Method]
POST
[Body]
{
"title": "Million dollar idea",
"text": "A dating service. With music."
}
Let me know if you would consider this as a feature. I am happy to implement this as a feature if you dont have time.
This ain file should output connection headers to stderr and print a json to stdout.
[Host]
http://localhost:3000/places
[Headers]
Content-Type: application/json
[Backend]
curl
[BackendOptions]
-sS -D /dev/stderr
But what actually happen is that stderr (the headers) are printed on stdout.
You can check this by running this line and reviewing the content of headers.txt file:
ain the_code_provided.ain 2>headers.txt
ain the_code_provided.ain | jq
And don't make crash the jq parser.
Thanks in advanced!
That's something that Insomnia does and makes it much faster to define requests. Is it something that is on your roadmap?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.