Comments (8)
I think that's reasonable. But it could conflict with reading the request body from stdin. I think maybe the logic should look like so:
- If only headers are read from stdin, then read stdin, line-by-line. Each line must be a header in
name: value
form. Blank lines are ignored as are lines that start with a#
(I'm a sucker for allowing comments if/when it's easy to support!). It probably needs to trim, too -- though maybe only trim from the left (to avoid leading whitespace in the header name, but allow trailing whitespace in the value?). - If only the request is read from stdin, then the current behavior should be preserved.
- If both are to be read from stdin, it should have the headers first, one per line, and then a blank line, and then the request body (much like an HTTP 1.1 request might look).
What do you think? I doubt I'll have time to implement this soon, but I'll accept a patch if you're up for this.
from grpcurl.
Actually, I just had a thought: what if instead we added a flag that allowed header values to be re-written via environment variable interpolation?
So instead of having to feed the headers in via stdin, you could do something like so:
grpcurl -expand-headers -H 'name: ${value}'
Note use of single quotes, so the shell won't expand ${value}
. Instead, grpcurl could do that, by search for ${...}
sequences and replacing them with the corresponding environment variable.
What do you think about that? I can actually see cases where both would be useful -- ability to interpolate env vars into the values and ability to pass via stdin... Anyhow, I think I'd take a patch that had either (or both!) of these approaches implemented.
from grpcurl.
Thanks for the second solution, I think that is much simpler and I'll put a PR in for that.
from grpcurl.
I'll have a PR opened shortly, already have the patch ready.
After putting in the PR, I would need a new release cut and build artifacts published. Is this possible?
from grpcurl.
@jhump Thanks for merging my PR, is there anyway you can cut a new release with accompanying binaries?
Also should we close this issue, or should we leave it open for also accepting headers from stdin?
from grpcurl.
@jammerful, we can leave this issue open as an enhancement request to also accept via stdin.
I should be able to do a release soon, early next week at the latest. I'm looking for other issues that I might be able to address, too, just so it's not such a small release.
from grpcurl.
@jhump Thanks, let me know if I can help at all.
from grpcurl.
@jammerful, FYI, a new v1.4.0 has been released that includes the change you landed.
from grpcurl.
Related Issues (20)
- Whether I can get the structure of the request parameters and response parameters of the grpc interface, this is very useful to me HOT 5
- Bump google.golang.org/grpc for CVE issue HOT 1
- With an UnaryResponse, OnReceiveResponse is never called HOT 1
- Fails to display response headers in case of "unexpected HTTP status code"
- Security Vulnerability: Update grpc version to at least 1.58.3 HOT 8
- Fail to inspect custom `gRPC` server HOT 2
- BUG - Failed to list methods for service "tamama.grpc.Tamama": Symbol not found: tamama.grpc.Tamama HOT 4
- `remote reset` error with 1.8.8 and higher HOT 1
- Wrong error message if a server requires client certificates
- Unix Domain Socket connection should use `localhost` authority header convention by default HOT 2
- Add the OpenSSF Scorecard Github Action HOT 1
- Attempts to install fail because of "missing do in first path element" HOT 2
- Cannot list methods of a service and make requests HOT 1
- Publish releases to winget HOT 1
- Possible to support other codec? HOT 1
- Server reflection fails when using well-known types (Timestamp) HOT 3
- Google Cloud Run producing `context deadline exceeded`
- protoset-out does not get namespace when using reflection HOT 5
- Create Process Failed to Run Issue HOT 1
- Include more output while connecting and reflecting with verbose mode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpcurl.