-
Notifications
You must be signed in to change notification settings - Fork 10
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
Emit request body only #521
Comments
So there are two feature requests here: You want to have more accurate control over the logging and you want to add some kind of transformer for incoming requests? I would be down for both. What's your design proposal (flags primarily) for the logging part? We could follow the convention of httpie. |
I like the idea of httpie's What about also adding Interestingly https://httpie.io/docs/cli/verbose-output If I have |
How will |
yea, I am playing around with this, and that is one of the significant issues. My initial thinking is that Another is that I havent found a way for clap "derive" to do Currently I have #[derive(clap::ValueEnum, Clone, Debug, PartialEq)]
pub enum PrintOption {
#[clap(name = "B")]
RequestBody,
#[clap(name = "H")]
RequestHeaders,
#[clap(name = "b")]
ResponseBody,
#[clap(name = "h")]
ResponseHeaders,
}
pub struct Args {
..
#[arg(long, value_delimiter = ',', num_args = 1..)]
pub print: Vec<PrintOption>,
..
} and I am running with that atm, using I'd like to be using something like https://docs.rs/enumset/latest/enumset/ My rough thinking is that the comma separators are annoying, but not a deal breaker, and once everything else is built, we can ask the clap team if there is an approach which will avoid the commas. |
I think here it would be reasonable to do a custom parser function to the get behavior from |
https://github.com/jayvdb/dummyhttp/tree/print-arg has a first cut with one commit . With that I can do Still a lot of work needed to determine how to integrate this to avoid duplication. As "colored" detects tty using If a user did So I am thinking that "┌─Incoming request" and "┌─Outgoing response" would only be used if I do wonder whether I checked apache logging, and it has no way to make Kong has a way to achieve POST logging, but that doesnt seem like it helps with a design. expressjs's morgan doesnt support bodies but can be extended to do this It looks like haproxy does have a mechanism for logging request bodies https://discourse.haproxy.org/t/log-http-request-body-and-performance-impact/6894 |
I think About the separators: Yeah no idea come to think of it. Maybe get rid of the separators altogether in case of |
I am using dummyhttp as a fake https://opentelemetry.io/ listener , receiving POST for events in our system, and have been using
-vv
to see the incoming events.I am less interested in the headers going in or out. Only the incoming POST body interests me. The incoming POST bodies are JSON. What would be even better is if the incoming JSON could be parsed into JSON and then emitted as a single line JSONL. i.e. removing all the newlines from the incoming POST ;-)
Obviously the design needs to be generic so that it would be useful for others also.
I'm happy to do all the work, provided it has a chance of being accepted.
The text was updated successfully, but these errors were encountered: