Skip to content

Commit

Permalink
Merge pull request #9 from Goryudyuma/useable-http2
Browse files Browse the repository at this point in the history
fix benchmarker useable http/2
  • Loading branch information
showwin authored Jun 23, 2018
2 parents aab9bd3 + d947715 commit a4120dd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions admin/benchmarker/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"time"

"github.com/PuerkitoBio/goquery"
"golang.org/x/net/http2"
)

func getInitialize() {
Expand Down Expand Up @@ -74,6 +75,9 @@ func httpsRequest(method string, path string, params url.Values) int {
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
if err := http2.ConfigureTransport(tr); err != nil {
log.Fatalf("Failed to configure h2 transport: %s", err)
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
client := http.Client{Transport: tr}

Expand All @@ -92,6 +96,9 @@ func httpsRequestDoc(method string, path string, params url.Values) *goquery.Doc
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
if err := http2.ConfigureTransport(tr); err != nil {
log.Fatalf("Failed to configure h2 transport: %s", err)
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
client := http.Client{Transport: tr}

Expand Down

0 comments on commit a4120dd

Please sign in to comment.