feat: support customizing timeout for specific route (#1203)

* feat: support customizing timeout for specific route

* test: add more tests
This commit is contained in:
Kevin Wan
2021-11-03 22:20:32 +08:00
committed by GitHub
parent 01786c5e63
commit 3ede597a15
5 changed files with 65 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import (
"net/http"
"net/http/httptest"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/tal-tech/go-zero/core/conf"
@@ -238,6 +239,12 @@ func TestWithPriority(t *testing.T) {
assert.True(t, fr.priority)
}
func TestWithTimeout(t *testing.T) {
var fr featuredRoutes
WithTimeout(time.Hour)(&fr)
assert.Equal(t, time.Hour, fr.timeout)
}
func TestWithTLSConfig(t *testing.T) {
const configYaml = `
Name: foo