rakyll / hey

HTTP load generator, ApacheBench (ab) replacement
Apache License 2.0
17.63k stars 1.17k forks source link

Add debug flag #251

Open ANGkeith opened 2 years ago

ANGkeith commented 2 years ago

closes #81

ANGkeith commented 2 years ago
$ hey -debug 'https://example.com' 
Client's Request:
> GET / HTTP/1.1
> Host: example.com
> Content-Type: text/html
> User-Agent: hey/0.0.1
> 
> 

Server's Response:
< HTTP/1.1 200 OK
< Age: 482996
< Cache-Control: max-age=604800
< Content-Type: text/html; charset=UTF-8
< Date: Sun, 18 Jul 2021 07:50:45 GMT
< Etag: "3147526947+gzip"
< Expires: Sun, 25 Jul 2021 07:50:45 GMT
< Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
< Server: ECS (sab/5783)
< Vary: Accept-Encoding
< X-Cache: HIT
< 
< <!doctype html>
< <html>
< <head>
<     <title>Example Domain</title>
< 
<     <meta charset="utf-8" />
<     <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<     <meta name="viewport" content="width=device-width, initial-scale=1" />
<     <style type="text/css">
<     body {
<         background-color: #f0f0f2;
<         margin: 0;
<         padding: 0;
<         font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
<         
<     }
<     div {
<         width: 600px;
<         margin: 5em auto;
<         padding: 2em;
<         background-color: #fdfdff;
<         border-radius: 0.5em;
<         box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);
<     }
<     a:link, a:visited {
<         color: #38488f;
<         text-decoration: none;
<     }
<     @media (max-width: 700px) {
<         div {
<             margin: 0 auto;
<             width: auto;
<         }
<     }
<     </style>    
< </head>
< 
< <body>
< <div>
<     <h1>Example Domain</h1>
<     <p>This domain is for use in illustrative examples in documents. You may use this
<     domain in literature without prior coordination or asking for permission.</p>
<     <p><a href="https://www.iana.org/domains/example">More information...</a></p>
< </div>
< </body>
< </html>
< 
ANGkeith commented 2 years ago

As mentioned https://stackoverflow.com/questions/64416015/golang-explain-dumprequest-and-dumpresponse-http-2 , the client request dump will always show GET / HTTP/1.1