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

[suggestion] added plain text format#4218 #4236

Closed
wants to merge 7 commits into from
Closed

[suggestion] added plain text format#4218 #4236

wants to merge 7 commits into from

Conversation

gerceboss
Copy link

Description

Linked issue

Closes #4218

Benefits

removes redundancy

Checklist

  • I've read CONTRIBUTING.md
  • I've used the standard signed-off commit format (or will squash just before merging)
  • All applicable CI checks pass (or I promised to make them pass later)
  • (optional) I've written unit tests for the code changes
  • I replied to all comments after code review, marking all implemented changes with thumbs up

Signed-off-by: Nilav Prajapati <[email protected]>
Signed-off-by: Nilav Prajapati <[email protected]>
Signed-off-by: Nilav Prajapati <[email protected]>
Signed-off-by: Nilav Prajapati <[email protected]>
@github-actions github-actions bot added the iroha2-dev The re-implementation of a BFT hyperledger in RUST label Jan 24, 2024
pub fn handle_health() -> Json {
reply::json(&Health::Healthy)
pub fn handle_health() -> impl warp::Reply {
warp::reply::with_status("Healthy", StatusCode::OK).header("Content-Type", "text/plain")
Copy link
Contributor

Choose a reason for hiding this comment

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

Returning a &'static str will be more terse and will still correctly set the Content-Type header: https://docs.rs/warp/latest/src/warp/reply.rs.html#436-443

use iroha_version::Version;

let string = sumeragi
.apply_wsv(WorldStateView::latest_block_ref)
.expect("Genesis not applied. Nothing we can do. Solve the issue and rerun.")
.version()
.to_string();
reply::json(&string)
warp::reply::with_status(string, warp::http::StatusCode::OK).header("Content-Type", "text/plain")
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, but can return the version String directly

@DCNick3
Copy link
Contributor

DCNick3 commented Jan 24, 2024

Also, please make sure your PR title and commit messages follow the format we use. This PR also should be a single commit (not four), as it is a small change.

@gerceboss
Copy link
Author

No problem ,I will do that by tomorrow

@mversic
Copy link
Contributor

mversic commented Feb 5, 2024

@gerceboss will you finalize this PR?

@6r1d
Copy link
Contributor

6r1d commented Feb 6, 2024

@gerceboss please comment :-)

@gerceboss gerceboss closed this by deleting the head repository Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iroha2-dev The re-implementation of a BFT hyperledger in RUST
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants