Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

req: set exit status based on: response / header existing #958

Open
philpennock opened this issue Jan 11, 2024 · 0 comments
Open

req: set exit status based on: response / header existing #958

philpennock opened this issue Jan 11, 2024 · 0 comments
Labels
proposal Enhancement idea or proposal

Comments

@philpennock
Copy link
Member

Proposed change

nats req foo input exits successfully always, even if it says No responders are available.

  1. nats req --fail-no-responder
  2. nats req --fail-if-header HDR

Use case

If not failing by default because "we talked to NATS fine" then we should have a flag for req of "exit failure from CLI tool if request did not have a responder". This will let us script based on "there was nothing there.

Second, if we're talking to a service then the service might respond indicating a failure, and use a NATS Header to report the header. One I'm looking at now uses Nats-Service-Error: some message and Nats-Service-Error-Code: 404 and then a JSON object to indicate the error in the payload. It would be really helpful if we could use a flag to cause nats req to exit indicating a failure if that this happened.

Ideally distinct error exit codes would be used for each of those two scenarios.

Contribution

I can do.

@philpennock philpennock added the proposal Enhancement idea or proposal label Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Enhancement idea or proposal
Projects
None yet
Development

No branches or pull requests

1 participant