Skip to content

armgit / hey

Public Imported from GitHub
0

HTTP load generator, ApacheBench (ab) replacement

Go

Allow for easy setting of the Accept header.

Eric J. Holmes1ce5d5a01d04
diff --git a/boom.go b/boom.go
index 46372bd..fe80c2e 100644
--- a/boom.go
+++ b/boom.go
@@ -31,6 +31,7 @@ var (
flagMethod = flag.String("m", "GET", "")
flagHeaders = flag.String("h", "", "")
flagD = flag.String("d", "", "")
+ flagAccept = flag.String("A", "", "")
flagType = flag.String("T", "text/html", "")
flagAuth = flag.String("a", "", "")
flagInsecure = flag.Bool("allow-insecure", false, "")
@@ -56,6 +57,7 @@ Options:
-m HTTP method, one of GET, POST, PUT, DELETE, HEAD, OPTIONS.
-h Custom HTTP headers, name1:value1;name2:value2.
+ -A HTTP Accept header.
-d HTTP request body.
-T Content-type, defaults to "text/html".
-a Basic authentication, username:password.
@@ -126,6 +128,10 @@ func main() {
}
}
+ if *flagAccept != "" {
+ header.Set("Accept", *flagAccept)
+ }
+
// set basic auth if set
if *flagAuth != "" {
re := regexp.MustCompile("([\\w|\\-|_|\\.]+):(\\w+)")