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

Support outputting the metadata of a response #240

Merged
merged 17 commits into from
Feb 19, 2023
Merged

Support outputting the metadata of a response #240

merged 17 commits into from
Feb 19, 2023

Conversation

ducaale
Copy link
Owner

@ducaale ducaale commented Mar 12, 2022

This PR adds support for outputting response's elapsed time as part of a new metadata section which can be enabled via either --print=m, a double invocation of the verbose flag i.e -vv, or via the --meta flag (similar to --headers and --body).

The duration of a response's elapsed time begins from when a request is made and ends when the response has been fully printed.

$ xh -vv httpbin.org/status/418

GET /status/418 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Host: httpbin.org
User-Agent: xh/0.15.0

HTTP/1.1 418 I'm a teapot
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Content-Length: 135
Date: Sat, 12 Mar 2022 21:30:13 GMT
Server: gunicorn/19.9.0
X-More-Info: http://tools.ietf.org/html/rfc2324


    -=[ teapot ]=-

       _...._
     .'  _ _ `.
    | ."` ^ `". _,
    \_;`"---"`|//
      |       ;/
      \_     _/
        `"""`


Elapsed time: 0.37325s

Ticks another item from #4

src/cli.rs Outdated Show resolved Hide resolved
@ducaale

This comment was marked as outdated.

@ducaale ducaale mentioned this pull request Mar 14, 2022
28 tasks
src/printer.rs Outdated Show resolved Hide resolved
src/cli.rs Outdated Show resolved Hide resolved
@ducaale ducaale marked this pull request as ready for review August 20, 2022 12:35
@ducaale ducaale changed the base branch from develop to master November 7, 2022 18:26
@ducaale ducaale requested a review from blyxxyz January 2, 2023 22:36
@ducaale
Copy link
Owner Author

ducaale commented Feb 19, 2023

I think this PR is ready now. I will merge it and we can fix any found issues later

@ducaale ducaale merged commit 32b0a5a into master Feb 19, 2023
@ducaale ducaale deleted the response-meta branch February 19, 2023 14:43
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

Successfully merging this pull request may close these issues.

1 participant