Skip to content

Commit b16e3ff

Browse files
committed
integration_tests/httpcache: add wait directive to query struct
1 parent 11fceb8 commit b16e3ff

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

integration_tests/httpcache/main.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"math/rand"
1313
"runtime"
1414
"strconv"
15+
"strings"
1516
"sync"
1617
"time"
1718

@@ -83,23 +84,27 @@ func main() {
8384

8485
type query struct {
8586
status *int
87+
wait time.Duration
8688
}
8789

8890
func (q *query) String() string {
8991
if q == nil {
9092
return ""
9193
}
9294

93-
var s string
95+
var args []string
9496

9597
if q.status != nil {
96-
if s != "" {
97-
s += "&"
98-
}
99-
s += fmt.Sprintf("status=%v", *q.status)
98+
s := fmt.Sprintf("status=%v", *q.status)
99+
args = append(args, s)
100+
}
101+
102+
if q.wait != 0 {
103+
s := fmt.Sprintf("wait=%v", q.wait.Milliseconds())
104+
args = append(args, s)
100105
}
101106

102-
return "?" + s
107+
return "?" + strings.Join(args, "&")
103108
}
104109

105110
func getTestReq(method string, q *query, body io.Reader) *fsthttp.Request {

0 commit comments

Comments
 (0)