Open linux-china opened 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.
@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.
@benfaerber Thanks for taking this on! As far as guidance, the main thing is just copy the boilerplate from Insomnia. Aside from that:
httparse
is already in the dependency tree via hyper so just make sure we don't end up with duplicate versions (cargo-tree is nice for that
)import.md
when you're donejetbrains
instead of just http
in the module/file naming. It's more specific, even if Jetbrains just calls it the "HTTP format"
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?