summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-05-02 16:34:03 +0300
committerWolfy-J <[email protected]>2019-05-02 16:34:03 +0300
commitff7693a6e1dbf5bb63c00eb66a3201e2cd955d20 (patch)
tree238b4a3f638b85180804458f97160455fcca1aff /service
parent677004f7cb97981f0220e2c65a2e7618505d01dc (diff)
parent64f2c19b0a9a33d97bd947e805d0491e68784423 (diff)
Merge branch 'pr/issue-121-rename_maxrequest_config_param' into feature/updates
Diffstat (limited to 'service')
-rw-r--r--service/http/config.go12
-rw-r--r--service/http/config_test.go81
-rw-r--r--service/http/handler.go4
-rw-r--r--service/http/handler_test.go48
-rw-r--r--service/http/rpc_test.go6
-rw-r--r--service/http/service_test.go20
-rw-r--r--service/http/uploads_test.go8
-rw-r--r--service/static/service_test.go18
8 files changed, 130 insertions, 67 deletions
diff --git a/service/http/config.go b/service/http/config.go
index 5a2c8768..7549cb6c 100644
--- a/service/http/config.go
+++ b/service/http/config.go
@@ -18,8 +18,12 @@ type Config struct {
SSL SSLConfig
// MaxRequest specified max size for payload body in megabytes, set 0 to unlimited.
+ // Deprecated: use `maxRequestSize` instead
MaxRequest int64
+ // MaxRequestSize specified max size for payload body in megabytes, set 0 to unlimited.
+ MaxRequestSize int64
+
// Uploads configures uploads configuration.
Uploads *UploadsConfig
@@ -68,6 +72,7 @@ func (c *Config) Hydrate(cfg service.Config) error {
return err
}
+ c.mergeBackwardCompatibility()
c.Workers.UpscaleDurations()
return c.Valid()
@@ -115,3 +120,10 @@ func (c *Config) Valid() error {
return nil
}
+
+// Perform merge operations for deprecated params to provide backward compatibility
+func (c *Config) mergeBackwardCompatibility() {
+ if c.MaxRequestSize == 0 && c.MaxRequest != 0 {
+ c.MaxRequestSize = c.MaxRequest
+ }
+}
diff --git a/service/http/config_test.go b/service/http/config_test.go
index 07901cb6..7c9d629a 100644
--- a/service/http/config_test.go
+++ b/service/http/config_test.go
@@ -31,8 +31,8 @@ func Test_Config_Hydrate_Error2(t *testing.T) {
func Test_Config_Valid(t *testing.T) {
cfg := &Config{
- Address: ":8080",
- MaxRequest: 1024,
+ Address: ":8080",
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{".go"},
@@ -58,7 +58,7 @@ func Test_Config_Valid_SSL(t *testing.T) {
Cert: "fixtures/server.crt",
Key: "fixtures/server.key",
},
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{".go"},
@@ -87,7 +87,7 @@ func Test_Config_SSL_No_key(t *testing.T) {
SSL: SSLConfig{
Cert: "fixtures/server.crt",
},
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{".go"},
@@ -112,7 +112,7 @@ func Test_Config_SSL_No_Cert(t *testing.T) {
SSL: SSLConfig{
Key: "fixtures/server.key",
},
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{".go"},
@@ -133,8 +133,8 @@ func Test_Config_SSL_No_Cert(t *testing.T) {
func Test_Config_NoUploads(t *testing.T) {
cfg := &Config{
- Address: ":8080",
- MaxRequest: 1024,
+ Address: ":8080",
+ MaxRequestSize: 1024,
Workers: &roadrunner.ServerConfig{
Command: "php tests/client.php echo pipes",
Relay: "pipes",
@@ -151,8 +151,8 @@ func Test_Config_NoUploads(t *testing.T) {
func Test_Config_NoWorkers(t *testing.T) {
cfg := &Config{
- Address: ":8080",
- MaxRequest: 1024,
+ Address: ":8080",
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{".go"},
@@ -164,8 +164,8 @@ func Test_Config_NoWorkers(t *testing.T) {
func Test_Config_NoPool(t *testing.T) {
cfg := &Config{
- Address: ":8080",
- MaxRequest: 1024,
+ Address: ":8080",
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{".go"},
@@ -186,8 +186,8 @@ func Test_Config_NoPool(t *testing.T) {
func Test_Config_DeadPool(t *testing.T) {
cfg := &Config{
- Address: ":8080",
- MaxRequest: 1024,
+ Address: ":8080",
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{".go"},
@@ -203,8 +203,8 @@ func Test_Config_DeadPool(t *testing.T) {
func Test_Config_InvalidAddress(t *testing.T) {
cfg := &Config{
- Address: "",
- MaxRequest: 1024,
+ Address: "",
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{".go"},
@@ -222,3 +222,54 @@ func Test_Config_InvalidAddress(t *testing.T) {
assert.Error(t, cfg.Valid())
}
+
+func Test_Config_MergeBackwardCompatibility_MaxRequestSize(t *testing.T) {
+ c := newTestBackwardCompatibilityConfig()
+ cfg := mockCfg{cfg: `{"maxRequestSize":512}`}
+ assert.NoError(t, c.Valid())
+ assert.NoError(t, c.Hydrate(&cfg))
+ assert.Equal(t, int64(512), int64(c.MaxRequestSize))
+
+ c = newTestBackwardCompatibilityConfig()
+ cfg = mockCfg{cfg: `{"maxRequestSize":256,"maxRequest":1024}`}
+ assert.NoError(t, c.Valid())
+ assert.NoError(t, c.Hydrate(&cfg))
+ assert.Equal(t, int64(256), int64(c.MaxRequestSize))
+
+ c = newTestBackwardCompatibilityConfig()
+ cfg = mockCfg{cfg: `{"maxRequestSize":256,"maxRequest":0}`}
+ assert.NoError(t, c.Valid())
+ assert.NoError(t, c.Hydrate(&cfg))
+ assert.Equal(t, int64(256), int64(c.MaxRequestSize))
+
+ c = newTestBackwardCompatibilityConfig()
+ cfg = mockCfg{cfg: `{"maxRequest":1024}`}
+ assert.NoError(t, c.Valid())
+ assert.NoError(t, c.Hydrate(&cfg))
+ assert.Equal(t, int64(1024), int64(c.MaxRequestSize))
+
+ c = newTestBackwardCompatibilityConfig()
+ cfg = mockCfg{cfg: `{"maxRequestSize":0,"maxRequest":1024}`}
+ assert.NoError(t, c.Valid())
+ assert.NoError(t, c.Hydrate(&cfg))
+ assert.Equal(t, int64(1024), int64(c.MaxRequestSize))
+}
+
+func newTestBackwardCompatibilityConfig() *Config {
+ return &Config{
+ Address: ":8080",
+ Uploads: &UploadsConfig{
+ Dir: os.TempDir(),
+ Forbid: []string{".go"},
+ },
+ Workers: &roadrunner.ServerConfig{
+ Command: "php tests/client.php echo pipes",
+ Relay: "pipes",
+ Pool: &roadrunner.Config{
+ NumWorkers: 1,
+ AllocateTimeout: time.Second,
+ DestroyTimeout: time.Second,
+ },
+ },
+ }
+}
diff --git a/service/http/handler.go b/service/http/handler.go
index 8cebc42a..a7a6d4d0 100644
--- a/service/http/handler.go
+++ b/service/http/handler.go
@@ -75,12 +75,12 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
start := time.Now()
// validating request size
- if h.cfg.MaxRequest != 0 {
+ if h.cfg.MaxRequestSize != 0 {
if length := r.Header.Get("content-length"); length != "" {
if size, err := strconv.ParseInt(length, 10, 64); err != nil {
h.handleError(w, r, err, start)
return
- } else if size > h.cfg.MaxRequest*1024*1024 {
+ } else if size > h.cfg.MaxRequestSize*1024*1024 {
h.handleError(w, r, errors.New("request body max size is exceeded"), start)
return
}
diff --git a/service/http/handler_test.go b/service/http/handler_test.go
index d876ef8e..6cedd4cd 100644
--- a/service/http/handler_test.go
+++ b/service/http/handler_test.go
@@ -32,7 +32,7 @@ func get(url string) (string, *http.Response, error) {
func TestHandler_Echo(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -67,7 +67,7 @@ func TestHandler_Echo(t *testing.T) {
func Test_HandlerErrors(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -94,7 +94,7 @@ func Test_HandlerErrors(t *testing.T) {
func Test_Handler_JSON_error(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -123,7 +123,7 @@ func Test_Handler_JSON_error(t *testing.T) {
func TestHandler_Headers(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -170,7 +170,7 @@ func TestHandler_Headers(t *testing.T) {
func TestHandler_Empty_User_Agent(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -216,7 +216,7 @@ func TestHandler_Empty_User_Agent(t *testing.T) {
func TestHandler_User_Agent(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -262,7 +262,7 @@ func TestHandler_User_Agent(t *testing.T) {
func TestHandler_Cookies(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -313,7 +313,7 @@ func TestHandler_Cookies(t *testing.T) {
func TestHandler_JsonPayload_POST(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -363,7 +363,7 @@ func TestHandler_JsonPayload_POST(t *testing.T) {
func TestHandler_JsonPayload_PUT(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -409,7 +409,7 @@ func TestHandler_JsonPayload_PUT(t *testing.T) {
func TestHandler_JsonPayload_PATCH(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -455,7 +455,7 @@ func TestHandler_JsonPayload_PATCH(t *testing.T) {
func TestHandler_FormData_POST(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -565,7 +565,7 @@ func TestHandler_FormData_POST_Overwrite(t *testing.T) {
func TestHandler_FormData_POST_Form_UrlEncoded_Charset(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -623,7 +623,7 @@ func TestHandler_FormData_POST_Form_UrlEncoded_Charset(t *testing.T) {
func TestHandler_FormData_PUT(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -681,7 +681,7 @@ func TestHandler_FormData_PUT(t *testing.T) {
func TestHandler_FormData_PATCH(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -739,7 +739,7 @@ func TestHandler_FormData_PATCH(t *testing.T) {
func TestHandler_Multipart_POST(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -801,7 +801,7 @@ func TestHandler_Multipart_POST(t *testing.T) {
func TestHandler_Multipart_PUT(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -863,7 +863,7 @@ func TestHandler_Multipart_PUT(t *testing.T) {
func TestHandler_Multipart_PATCH(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -925,7 +925,7 @@ func TestHandler_Multipart_PATCH(t *testing.T) {
func TestHandler_Error(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -959,7 +959,7 @@ func TestHandler_Error(t *testing.T) {
func TestHandler_Error2(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -993,7 +993,7 @@ func TestHandler_Error2(t *testing.T) {
func TestHandler_Error3(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1,
+ MaxRequestSize: 1,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -1038,7 +1038,7 @@ func TestHandler_Error3(t *testing.T) {
func TestHandler_ResponseDuration(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -1087,7 +1087,7 @@ func TestHandler_ResponseDuration(t *testing.T) {
func TestHandler_ResponseDurationDelayed(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -1136,7 +1136,7 @@ func TestHandler_ResponseDurationDelayed(t *testing.T) {
func TestHandler_ErrorDuration(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -1184,7 +1184,7 @@ func TestHandler_ErrorDuration(t *testing.T) {
func BenchmarkHandler_Listen_Echo(b *testing.B) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
diff --git a/service/http/rpc_test.go b/service/http/rpc_test.go
index ba3efd2e..669b201c 100644
--- a/service/http/rpc_test.go
+++ b/service/http/rpc_test.go
@@ -27,7 +27,7 @@ func Test_RPC(t *testing.T) {
httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -88,7 +88,7 @@ func Test_RPC_Unix(t *testing.T) {
httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -142,7 +142,7 @@ func Test_Workers(t *testing.T) {
httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
diff --git a/service/http/service_test.go b/service/http/service_test.go
index d1d601dc..5b6d60d8 100644
--- a/service/http/service_test.go
+++ b/service/http/service_test.go
@@ -84,7 +84,7 @@ func Test_Service_Configure_Enable(t *testing.T) {
assert.NoError(t, c.Init(&testCfg{httpCfg: `{
"enable": true,
"address": ":8070",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -115,7 +115,7 @@ func Test_Service_Echo(t *testing.T) {
assert.NoError(t, c.Init(&testCfg{httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -168,7 +168,7 @@ func Test_Service_Env(t *testing.T) {
assert.NoError(t, c.Init(&testCfg{httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -220,7 +220,7 @@ func Test_Service_ErrorEcho(t *testing.T) {
assert.NoError(t, c.Init(&testCfg{httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -280,7 +280,7 @@ func Test_Service_Middleware(t *testing.T) {
assert.NoError(t, c.Init(&testCfg{httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -354,7 +354,7 @@ func Test_Service_Listener(t *testing.T) {
assert.NoError(t, c.Init(&testCfg{httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -398,7 +398,7 @@ func Test_Service_Error(t *testing.T) {
assert.NoError(t, c.Init(&testCfg{httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -427,7 +427,7 @@ func Test_Service_Error2(t *testing.T) {
assert.NoError(t, c.Init(&testCfg{httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -456,7 +456,7 @@ func Test_Service_Error3(t *testing.T) {
assert.Error(t, c.Init(&testCfg{httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -483,7 +483,7 @@ func Test_Service_Error4(t *testing.T) {
assert.Error(t, c.Init(&testCfg{httpCfg: `{
"enable": true,
"address": "----",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
diff --git a/service/http/uploads_test.go b/service/http/uploads_test.go
index d452f834..0fbf0e14 100644
--- a/service/http/uploads_test.go
+++ b/service/http/uploads_test.go
@@ -20,7 +20,7 @@ import (
func TestHandler_Upload_File(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -81,7 +81,7 @@ func TestHandler_Upload_File(t *testing.T) {
func TestHandler_Upload_NestedFile(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{},
@@ -142,7 +142,7 @@ func TestHandler_Upload_NestedFile(t *testing.T) {
func TestHandler_Upload_File_NoTmpDir(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: "-----",
Forbid: []string{},
@@ -203,7 +203,7 @@ func TestHandler_Upload_File_NoTmpDir(t *testing.T) {
func TestHandler_Upload_File_Forbids(t *testing.T) {
h := &Handler{
cfg: &Config{
- MaxRequest: 1024,
+ MaxRequestSize: 1024,
Uploads: &UploadsConfig{
Dir: os.TempDir(),
Forbid: []string{".go"},
diff --git a/service/static/service_test.go b/service/static/service_test.go
index af616418..d69b2fdd 100644
--- a/service/static/service_test.go
+++ b/service/static/service_test.go
@@ -60,7 +60,7 @@ func Test_Files(t *testing.T) {
httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -113,7 +113,7 @@ func Test_Files_Disable(t *testing.T) {
httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -150,7 +150,7 @@ func Test_Files_Error(t *testing.T) {
httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -180,7 +180,7 @@ func Test_Files_Error2(t *testing.T) {
httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -210,7 +210,7 @@ func Test_Files_Forbid(t *testing.T) {
httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -247,7 +247,7 @@ func Test_Files_Always(t *testing.T) {
httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -284,7 +284,7 @@ func Test_Files_NotFound(t *testing.T) {
httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -321,7 +321,7 @@ func Test_Files_Dir(t *testing.T) {
httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []
@@ -358,7 +358,7 @@ func Test_Files_NotForbid(t *testing.T) {
httpCfg: `{
"enable": true,
"address": ":6029",
- "maxRequest": 1024,
+ "maxRequestSize": 1024,
"uploads": {
"dir": ` + tmpDir() + `,
"forbid": []