mistweaverco/kulala.nvim

[Feature Request] Allow specifying host as a header

Closed this issue · 8 comments

Hello!

rest.nvim has a nice feature: it's possible to specify the host as if it were a header. They call that "URL without Host". For instance:

GET /api
HOST: example.com

It'd be nice to have that in kulala as well.

@igorlfs I don‘t see any use case for this, please explain what advantage you see over putting the host directly to the request line or use variables like {host}/api and define @host somewhere.

what advantage you see over putting the host directly to the request line or use variables like {host}/api and define @host somewhere.

Indeed, defining a variable solves most use cases (eg, a long URL), and I'd say is the recommend way. However, I've noticed that multiple APIs are documented with examples that already include the Host. So, by having this feature, copy-pasting from such examples would be easier.

Can you elaborate a bit more? Maybe with some example docs links? I usually work with a lot of different APIs on a daily basis, but never found it hard to copy from their docs into .http 🤷🏾.

I'm really curious 🧐 what these API docs look like.

Can you elaborate a bit more?

Sure! Here is an example from salesforce. Here's another one (though I'm not sure if this works properly, since both the URL contains the Host and the Host is also specified). Those are the examples off the top of my head, but I'm sure I've seen others, so I'd assumed it was somewhat common.

First one has Host: BEFORE request line and not part of header lines….

Yeah, that was definitely odd

I would rather not implement this, because it makes building the curl command a lot harder with little to no benefit.

Maybe we can reopen, if we have TS enabled by default. This could make things significantly easier, when it comes to special cases like this.

I would rather not implement this

Sure, no problem!