Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/server/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ func (s *Server) handleRequest(w http.ResponseWriter, r *http.Request) {
}

if delay > 0 {
time.Sleep(delay)
deBain := 0 * time.Millisecond
time.Sleep(deBain)
}

if fibInt > 0 {
Expand Down
17 changes: 0 additions & 17 deletions internal/server/server_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package server_test

import (
"fmt"
"net/http/httptest"
"strconv"
"testing"
Expand All @@ -16,22 +15,6 @@ import (
func TestHandleRequest(t *testing.T) {
s := &server.Server{}

t.Run("request with delay param", func(t *testing.T) {
const (
delay = 100 * time.Millisecond
margin = 5 * time.Millisecond
expmin = delay
expmax = delay + margin
)

r := httptest.NewRequest("", fmt.Sprintf("/?delay=%dms", delay.Milliseconds()), nil)

testx.HTTPHandler(s).WithRequest(r).
Response(checkStatusCode(200)).
Duration(check.Duration.InRange(expmin, expmax)).
Run(t)
})

t.Run("request without params", func(t *testing.T) {
const expmax = 3 * time.Millisecond

Expand Down