LucasPickering / slumber

Terminal-based HTTP/REST client
https://slumber.lucaspickering.me/
MIT License
422 stars 20 forks source link

Any plan to support JetBrains HTTP file format? #122

Open linux-china opened 8 months ago

linux-china commented 8 months ago

I found that Slumber and JetBrains HTTP file share most concepts, such as profile/environment, recipes/targets etc. Yes, slumber.yml is good to write http requests, but http file is better DSL in http. VS code has http file support too.

Could Slumber add support for JetBrains http file?

LucasPickering commented 8 months ago

It'd be possible to add this as an import target, similar to Insomnia. You would run a command once to generate a Slumber collection based on your HTTP file. It requires more work than Insomnia though because we would need a parser for this HTTP format. It looks like there's a library for it in Rust called http-rest-file but I'm not sure if it will actually work, it doesn't look very polished.

benfaerber commented 6 months ago

@LucasPickering I'm working on this, here's my fork: https://github.com/benfaerber/slumber/tree/add-http-file-support

I'm planning on using nom to parse the basic format and then httparse to parse the actual request portion. I think this is better because httparse is a very popular crate and the rest of the format is pretty simple to implement (just separators and variables)

Let me know if I should know anything before going further.

LucasPickering commented 6 months ago

@benfaerber Thanks for taking this on! As far as guidance, the main thing is just copy the boilerplate from Insomnia. Aside from that: