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

-default-header would be clear when using -examples at the same time #237

Closed
jtsai-dev opened this issue Apr 13, 2023 · 2 comments
Closed

Comments

@jtsai-dev
Copy link
Contributor

i have been develop some grpc API which most of them need to be auth when requesting as set the token for header with Authorization:Bearer xxx.
And i written some examples for request, start the grpcui with command

grpcui -default-header 'Authorization:Bearer xxx' -examples '\examples\request.json' -plaintext localhost:3010

the content of request.json almost as follows

[{
    "name": "Apply",
    "service": "xxxService",
    "method": "Apply",
    "request": {
      "data": {
        "Id": "1",
        "Email": "a@example.com"
      }
    }
  }
  ...
]

when i choose the [Apply] in grpcui's webForm, the default header will be clear, i knew it could be set 'Metadata' in json file, but when the token expired for security reasons, i need to rewrite all the metadata in json file, that is so terrible.
so, are there any way to set -default-header as default if it is empty in json file, so i can rewrite it only once in start command?

@jhump
Copy link
Contributor

jhump commented Apr 13, 2023

@yyeiei, checkout the -H and -rpc-header arguments. These are always supplied to the server, not shown in the UI, and cannot be overridden. They are perfect for things like credentials. This was added just over a year ago in v1.3.0.

See #163 for more details about these flags and others newly added at the same time.

@jtsai-dev
Copy link
Contributor Author

I had tried to use -H instead of -default-header, and it solved my problem! I will close this issue.

By the way, there is an exception when using examples: it will be undefined without setting in json file. I created a pull request, you can just review it #238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants