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

Add option --very-verbose #499

Closed
fabricereix opened this issue Mar 10, 2022 · 4 comments · Fixed by #623
Closed

Add option --very-verbose #499

fabricereix opened this issue Mar 10, 2022 · 4 comments · Fixed by #623
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@fabricereix
Copy link
Collaborator

Be more verbose:

  • output response body
@fabricereix fabricereix added the enhancement New feature or request label Mar 10, 2022
@fabricereix fabricereix added this to the 1.7.0 milestone Mar 10, 2022
@jcamiel jcamiel self-assigned this May 5, 2022
@hemedani
Copy link

hemedani commented Jun 6, 2022

It's a very important issue
Please take a great attention to it

@jcamiel
Copy link
Collaborator

jcamiel commented Jun 6, 2022

@hemedani To be clear about this option, we plan to this:

Given this Hurl file:

GET https://www.google.fr

GET https://www.google.fr

GET https://www.google.fr

The current output for --verboseoption is:

$ hurl --verbose test.hurl

* fail fast: true
* insecure: false
* follow redirect: false
* max redirect: 50
* ------------------------------------------------------------------------------
* executing entry 1
* 
* Cookie store:
* 
* Request
* GET https://www.google.fr
* 
* request can be run with the following curl command:
* curl 'https://www.google.fr'
*
> GET / HTTP/2
> ... request headers
> 
< HTTP/2 200 
< ... response headers
* 
* ------------------------------------------------------------------------------
* executing entry 2
* 
* Cookie store:
* ... cookies
*  
* Request
* GET https://www.google.fr
* 
* request can be run with the following curl command:
* ...
* 
> GET / HTTP/2
> ... request headers
> 
< HTTP/2 302 
< ... response headers
< 
* 
* ------------------------------------------------------------------------------
* executing entry 3
* 
* Cookie store:
* ...
*  
* Request
* GET https://www.google.fr
* 
* request can be run with the following curl command:
* ...
*
> GET / HTTP/2
> ... request headers
> 
< HTTP/2 302 
< ... response headers
< 
* 
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="https://consent.google.fr/ml?continue=https://www.google.fr/&amp;gl=FR&amp;m=0&amp;pc=shp&amp;uxe=eomcs4&amp;hl=fr&amp;src=1">here</A>.
</BODY></HTML>

With --very-verbose, we plan to output the response body for each entry

GET https://www.google.fr

GET https://www.google.fr

GET https://www.google.fr

The current output for --verboseoption is:

$ hurl --verbose test.hurl

* fail fast: true
* insecure: false
* follow redirect: false
* max redirect: 50
* ------------------------------------------------------------------------------
* executing entry 1
* 
* Cookie store:
* 
* Request
* GET https://www.google.fr
* 
* request can be run with the following curl command:
* curl 'https://www.google.fr'
*
> GET / HTTP/2
> ... request headers
> 
< HTTP/2 200 
< ... response headers
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="https://consent.google.fr/ml?continue=https://www.google.fr/&amp;gl=FR&amp;m=0&amp;pc=shp&amp;uxe=eomcs4&amp;hl=fr&amp;src=1">here</A>.
</BODY></HTML>
* 
* ------------------------------------------------------------------------------
* executing entry 2
* 
* Cookie store:
* ... cookies
*  
* Request
* GET https://www.google.fr
* 
* request can be run with the following curl command:
* ...
* 
> GET / HTTP/2
> ... request headers
> 
< HTTP/2 302 
< ... response headers
< 
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="https://consent.google.fr/ml?continue=https://www.google.fr/&amp;gl=FR&amp;m=0&amp;pc=shp&amp;uxe=eomcs4&amp;hl=fr&amp;src=1">here</A>.
</BODY></HTML>
* 
* ------------------------------------------------------------------------------
* executing entry 3
* 
* Cookie store:
* ...
*  
* Request
* GET https://www.google.fr
* 
* request can be run with the following curl command:
* ...
*
> GET / HTTP/2
> ... request headers
> 
< HTTP/2 302 
< ... response headers
< 
* 
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="https://consent.google.fr/ml?continue=https://www.google.fr/&amp;gl=FR&amp;m=0&amp;pc=shp&amp;uxe=eomcs4&amp;hl=fr&amp;src=1">here</A>.
</BODY></HTML>

It's fine for debugging (it will be outputted to stderr like other logs). If you want to parse Hurl output to print a custom output, maybe you can use --json option that output Hurl execution in a structured file (very like HAR). With --json, you won't have the response bodies buy maybe @fabricereix we should include it?

@hemedani
Copy link

hemedani commented Jun 6, 2022

it's nice

@fabricereix
Copy link
Collaborator Author

Yes, we could also include the body in the JSON output.
HAR only stores body as text. It consists of a content object field, which has both a text and encoding field.
for example

"content": {
    "size": 33,
    "compression": 0,
    "mimeType": "text/html; charset=utf-8",
    "text": "PGh0bWw+PGhlYWQ+PC9oZWFkPjxib2R5Lz48L2h0bWw+XG4=",
    "encoding": "base64",
    "comment": ""
}

By choosing only the base64 encoding (even for the utf8-encoded body), we could avoid specifying the encoding explicitly
and use directly the string field body.

@jcamiel jcamiel linked a pull request Jun 17, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants