refactor: move hrp/ to root folder

This commit is contained in:
lilong.129
2025-02-06 10:52:08 +08:00
parent 9376692b71
commit 1f063dd6f7
221 changed files with 206 additions and 211 deletions

View File

@@ -0,0 +1,38 @@
package demo
import (
"fmt"
"net/http"
"testing"
"time"
"github.com/httprunner/httprunner/v5/pkg/httpstat"
)
func TestMain(t *testing.T) {
var httpStat httpstat.Stat
req, _ := http.NewRequest("GET", "https://httprunner.com", nil)
ctx := httpstat.WithHTTPStat(req, &httpStat)
client := &http.Client{
Timeout: time.Second * 10,
}
req = req.WithContext(ctx)
resp, err := client.Do(req)
if err != nil {
t.Fatal(err)
}
if resp != nil {
defer resp.Body.Close()
}
// get stat
httpStat.Finish()
result := httpStat.Durations()
fmt.Println(result)
// print stat
httpStat.Print()
}