Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

debuapi: Optionally read from stdin for Body #2149

Merged
merged 1 commit into from
Aug 11, 2020
Merged

debuapi: Optionally read from stdin for Body #2149

merged 1 commit into from
Aug 11, 2020

Conversation

utopiabound
Copy link
Contributor

@utopiabound utopiabound commented Aug 11, 2020

Related #1832

Signed-off-by: Nathaniel Clark nclark@whamcloud.com


This change is Reviewable

Signed-off-by: Nathaniel Clark <nclark@whamcloud.com>
@utopiabound utopiabound added this to the IML EX V3 milestone Aug 11, 2020
@utopiabound utopiabound requested a review from a team August 11, 2020 20:17
@utopiabound utopiabound self-assigned this Aug 11, 2020
@jgrund jgrund requested a review from a team August 11, 2020 20:20
let mut buf: Vec<u8> = Vec::new();
stdin().read_to_end(&mut buf).await?;
let s = String::from_utf8_lossy(&buf);
Some(serde_json::from_str(&s)?)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could probably convert the result to an option here.

serde_json::from_str(&s).ok()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would lose whatever the error was though

@jgrund jgrund merged commit cdab325 into master Aug 11, 2020
@jgrund jgrund deleted the debugapi-stdin branch August 11, 2020 20:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants