Added support for setting the parameter size accepted by the interface and custom timeout and maxbytes in API file (#1713)
* Added support for setting the parameter size accepted by the interface * support custom timeout and maxbytes in API file * support timeout used unit * remove goctl maxBytes
This commit is contained in:
@@ -194,6 +194,41 @@ func TestEngine_checkedTimeout(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestEngine_checkedMaxBytes(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
maxBytes int64
|
||||
expect int64
|
||||
}{
|
||||
{
|
||||
name: "not set",
|
||||
expect: 1000,
|
||||
},
|
||||
{
|
||||
name: "less",
|
||||
maxBytes: 500,
|
||||
expect: 500,
|
||||
},
|
||||
{
|
||||
name: "equal",
|
||||
maxBytes: 1000,
|
||||
expect: 1000,
|
||||
},
|
||||
{
|
||||
name: "more",
|
||||
maxBytes: 1500,
|
||||
expect: 1500,
|
||||
},
|
||||
}
|
||||
|
||||
ng := newEngine(RestConf{
|
||||
MaxBytes: 1000,
|
||||
})
|
||||
for _, test := range tests {
|
||||
assert.Equal(t, test.expect, ng.checkedMaxBytes(test.maxBytes))
|
||||
}
|
||||
}
|
||||
|
||||
func TestEngine_notFoundHandler(t *testing.T) {
|
||||
logx.Disable()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user