mistweaverco / kulala.nvim

A minimal 🤏 HTTP-client 🐼 interface 🖥️ for Neovim ❤️.
https://kulala.mwco.app
MIT License
595 stars 28 forks source link

[Header issue] Authorization header can't be send if it's Base64 format #36

Closed fijar-lazuardy closed 2 months ago

fijar-lazuardy commented 3 months ago

I have authorization header that is base64 encoded so something like

Authorization: Basic Base64encodedstring==

But the "==" make it doesn't work. any idea to make it work?

gorillamoe commented 3 months ago

Hey there, thanks for raising this issue.

I'm aware of the issue with parsing the headers. The current implementation works well enough for a release, so I released it, but it's nevertheless kinda broken.

So you can work around that by utilizing the ability to store sensitive information in an external "environment" file, which shouldn't be checked into source control, but can be sent to colleagues..

Something like this might work:

Put a http-client.env.json file in the same dir your *.http file is or somewhere above that directory (because kulala searches upwards, until it finds one of these files).

The contents of this file should look something like this:

{
  "dev": {
    "auth_header": "Basic Base64encodedstring=="
  },
  "prod": {
    "auth_header": "Basic Base64encodedstring=="
  }
}

Then the http file should look something like this:

GET http://localhost:3000/api/v2/get_stuff HTTP/1.1
accept: application/json
authorization: {{auth_header}}

I'm already working on a complete rewrite of the parser --> #18

fijar-lazuardy commented 2 months ago

will try later, thanks for the response!

gorillamoe commented 2 months ago

Should be possible with the new v2.0.0 release and the completely new parser.