Skip to content
Merged
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
24 changes: 16 additions & 8 deletions api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ func TestHTTPClientTimeout(t *testing.T) {
})

// Create a test server that introduces a delay
testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(200 * time.Millisecond) // Delay longer than client timeout
w.WriteHeader(http.StatusOK)
}))
testServer := httptest.NewServer(
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(
200 * time.Millisecond,
) // Delay longer than client timeout
w.WriteHeader(http.StatusOK)
}),
)
defer testServer.Close()

// Make a request to the test server
Expand All @@ -43,10 +47,14 @@ func TestHTTPClientTimeoutPass(t *testing.T) {
})

// Create a test server that introduces a delay
testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(200 * time.Millisecond) // Delay shorter than client timeout
w.WriteHeader(http.StatusOK)
}))
testServer := httptest.NewServer(
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(
200 * time.Millisecond,
) // Delay shorter than client timeout
w.WriteHeader(http.StatusOK)
}),
)
defer testServer.Close()

// Make a request to the test server
Expand Down
6 changes: 3 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ type LoggingConfig struct {
}

type ApiConfig struct {
ListenAddress string `yaml:"address" envconfig:"API_LISTEN_ADDRESS"`
ListenPort uint `yaml:"port" envconfig:"API_LISTEN_PORT"`
ClientTimeout uint `yaml:"client_timeout" envconfig:"CLIENT_TIMEOUT"`
ListenAddress string `yaml:"address" envconfig:"API_LISTEN_ADDRESS"`
ListenPort uint `yaml:"port" envconfig:"API_LISTEN_PORT"`
ClientTimeout uint `yaml:"client_timeout" envconfig:"CLIENT_TIMEOUT"`
}

// Singleton config instance with default values
Expand Down