fnproject/cli

Add request HTTP headers to "fn invoke"

denismakogon opened this issue · 4 comments

As a user I'd like to specify HTTP headers like fn invoke blah blah --http-header 'Blah: blah'

Doesn't seem unreasonable.

there are two features that I'd like to see as part of the CLI: #546 and this. They both related, the one is all about HTTP headers to make HTTP requests complete and the second one is all about providing a short path to get invoke annotation in order to use it with OCI cURL (or any other HTTP CLI tool).

Just to double check, do you mean something that replicates:

curl -H 'My-header: foo' http://localhost:8080/t/myapp/getheaders-trigger

If so this should be easy enough to do. Just need to watch out for someone doing something like:

fn invoke myapp getheaders --content-type 'application/json' --http-header 'My-header: Foo' --http-header 'Content-Type: text/plain'

Yeah, my original idea was about doing exactly what you’ve shown. But later I start evaluating this particular feature. Eventually all I need is already implemented in the cURL and the invoke endpoint I can get from fn inspect fn ––endpoint app fn.
.
So, not sure if it’s really worth it.