feat: add ability to pass certs#519
Conversation
A key feature that is missing from what I can tell is the ability to pass a cert/key. This change request is to add a cert/key via configuration based on the host. If it matches that host, then the file path for the certs/keys will be added to the request. Changes: - Add `--cert` and `--key` flag with file path to docs - Add a configuration setup so the keys are only sent with the corresponding request
|
I still need to add tests and update the docs, and sort out some code that I've amended in error with formatting. Is this something that you would be interesting in? |
boltlessengineer
left a comment
There was a problem hiding this comment.
Thank you for your contribution! Yes, we definitely need this feature. I can merge this PR when it is ready.
Please avoid including unnecessary code reformats ;)
|
Please find all comments resolved, and I've added docs and tests. Linting, formatting and tests are all green 💪 |
| for domain, _ in pairs(config.clients.curl.opts.certificates) do | ||
| local target = req.url | ||
|
|
||
| local s, _ = string.find(target, domain, 1, true) |
There was a problem hiding this comment.
We already have domain matching functionality in cookie_jar.lua so we can use same logic for both, but for now, I think this is fine. I might add a TODO comment here though.
rest.nvim/lua/rest-nvim/cookie_jar.lua
Lines 172 to 199 in 404a262
boltlessengineer
left a comment
There was a problem hiding this comment.
LGTM. I’ll squash-merge it after adding a commit with some minor fixes.
- add some todo comments - remove unnecessary `Certificates` type - add short explanation to new config field - fix wrong method execution on test code
A key feature that is missing from what I can tell is the ability to pass a cert/key. This change request is to add a cert/key via configuration based on the host. If it matches that host, then the file path for the certs/keys will be added to the request.
Changes:
--certand--keyflag with file path to docs