Closed jnmoyne closed 2 weeks ago
Well this seems like a feature - though granted a its a weird one.
For headers we have --header and -H you can do --header=X:Y
or --header X:Y
but for the short version we don't support the equal so only -H X:Y
or -HX:Y
Seems weird yeah, anyway so I looked around and this is how unix typically work you can test with curl
% curl -H=X:y -v https://google.com
....
> GET / HTTP/2
> Host: google.com
> user-agent: curl/7.76.1
> accept: */*
> =x:y
* HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
....
This is also how getopt
works:
$ getopt -o H: --long header: -- --header X:Y
--header 'X:Y' --
$ getopt -o H: --long header: -- --header=X:Y
--header 'X:Y' --
$ getopt -o H: --long header: -- -HX:Y
-H 'X:Y' --
$ getopt -o H: --long header: -- -H X:Y
-H 'X:Y' --
$ getopt -o H: --long header: -- -H=X:Y
-H '=X:Y' --
So this seems consistent and correct but yeah its weird.
Weird indeed, learn something new every day...
Observed behavior
In pub/request commands the
-H
flag gets ignored if the value is passed after a=
rather than a space.e.g.:
nats pub a -H Nats-Msg-Id:1 ss
-> works, the header is in the published messagenats pub a -H=Nats-Msg-Id:1 ss
-> doses NOT work, the message is published without the headerExpected behavior
nats pub a -H=Nats-Msg-Id:1 ss
should work (the header should be included in the message published)Server and client version
any
Host environment
No response
Steps to reproduce
In one window do
nats sub a --headers-only
, and in another window do:nats pub a -H Nats-Msg-Id:1 ss
-> works, the header is in the published messagenats pub a -H=Nats-Msg-Id:1 ss
-> doses NOT work, the message is published without the header