diff --git a/contracts/http/mocks/Request.go b/contracts/http/mocks/Request.go index 0890732b2..7896c3a93 100644 --- a/contracts/http/mocks/Request.go +++ b/contracts/http/mocks/Request.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. +// Code generated by mockery v2.32.4. DO NOT EDIT. package mocks @@ -28,6 +28,22 @@ func (_m *Request) AbortWithStatusJson(code int, jsonObj interface{}) { _m.Called(code, jsonObj) } +// All provides a mock function with given fields: +func (_m *Request) All() map[string]interface{} { + ret := _m.Called() + + var r0 map[string]interface{} + if rf, ok := ret.Get(0).(func() map[string]interface{}); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[string]interface{}) + } + } + + return r0 +} + // Bind provides a mock function with given fields: obj func (_m *Request) Bind(obj interface{}) error { ret := _m.Called(obj) @@ -47,6 +63,10 @@ func (_m *Request) File(name string) (filesystem.File, error) { ret := _m.Called(name) var r0 filesystem.File + var r1 error + if rf, ok := ret.Get(0).(func(string) (filesystem.File, error)); ok { + return rf(name) + } if rf, ok := ret.Get(0).(func(string) filesystem.File); ok { r0 = rf(name) } else { @@ -55,7 +75,6 @@ func (_m *Request) File(name string) (filesystem.File, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(string) error); ok { r1 = rf(name) } else { @@ -137,6 +156,20 @@ func (_m *Request) Headers() nethttp.Header { return r0 } +// Host provides a mock function with given fields: +func (_m *Request) Host() string { + ret := _m.Called() + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + // Input provides a mock function with given fields: key, defaultValue func (_m *Request) Input(key string, defaultValue ...string) string { _va := make([]interface{}, len(defaultValue)) @@ -158,6 +191,29 @@ func (_m *Request) Input(key string, defaultValue ...string) string { return r0 } +// InputArray provides a mock function with given fields: key, defaultValue +func (_m *Request) InputArray(key string, defaultValue ...[]string) []string { + _va := make([]interface{}, len(defaultValue)) + for _i := range defaultValue { + _va[_i] = defaultValue[_i] + } + var _ca []interface{} + _ca = append(_ca, key) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 []string + if rf, ok := ret.Get(0).(func(string, ...[]string) []string); ok { + r0 = rf(key, defaultValue...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + return r0 +} + // InputBool provides a mock function with given fields: key, defaultValue func (_m *Request) InputBool(key string, defaultValue ...bool) bool { _va := make([]interface{}, len(defaultValue)) @@ -221,6 +277,29 @@ func (_m *Request) InputInt64(key string, defaultValue ...int64) int64 { return r0 } +// InputMap provides a mock function with given fields: key, defaultValue +func (_m *Request) InputMap(key string, defaultValue ...map[string]string) map[string]string { + _va := make([]interface{}, len(defaultValue)) + for _i := range defaultValue { + _va[_i] = defaultValue[_i] + } + var _ca []interface{} + _ca = append(_ca, key) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 map[string]string + if rf, ok := ret.Get(0).(func(string, ...map[string]string) map[string]string); ok { + r0 = rf(key, defaultValue...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[string]string) + } + } + + return r0 +} + // Ip provides a mock function with given fields: func (_m *Request) Ip() string { ret := _m.Called() @@ -305,6 +384,22 @@ func (_m *Request) Path() string { return r0 } +// Queries provides a mock function with given fields: +func (_m *Request) Queries() map[string]string { + ret := _m.Called() + + var r0 map[string]string + if rf, ok := ret.Get(0).(func() map[string]string); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[string]string) + } + } + + return r0 +} + // Query provides a mock function with given fields: key, defaultValue func (_m *Request) Query(key string, defaultValue ...string) string { _va := make([]interface{}, len(defaultValue)) @@ -489,6 +584,10 @@ func (_m *Request) Validate(rules map[string]string, options ...validation.Optio ret := _m.Called(_ca...) var r0 validation.Validator + var r1 error + if rf, ok := ret.Get(0).(func(map[string]string, ...validation.Option) (validation.Validator, error)); ok { + return rf(rules, options...) + } if rf, ok := ret.Get(0).(func(map[string]string, ...validation.Option) validation.Validator); ok { r0 = rf(rules, options...) } else { @@ -497,7 +596,6 @@ func (_m *Request) Validate(rules map[string]string, options ...validation.Optio } } - var r1 error if rf, ok := ret.Get(1).(func(map[string]string, ...validation.Option) error); ok { r1 = rf(rules, options...) } else { @@ -512,6 +610,10 @@ func (_m *Request) ValidateRequest(request http.FormRequest) (validation.Errors, ret := _m.Called(request) var r0 validation.Errors + var r1 error + if rf, ok := ret.Get(0).(func(http.FormRequest) (validation.Errors, error)); ok { + return rf(request) + } if rf, ok := ret.Get(0).(func(http.FormRequest) validation.Errors); ok { r0 = rf(request) } else { @@ -520,7 +622,6 @@ func (_m *Request) ValidateRequest(request http.FormRequest) (validation.Errors, } } - var r1 error if rf, ok := ret.Get(1).(func(http.FormRequest) error); ok { r1 = rf(request) } else { @@ -530,13 +631,12 @@ func (_m *Request) ValidateRequest(request http.FormRequest) (validation.Errors, return r0, r1 } -type mockConstructorTestingTNewRequest interface { +// NewRequest creates a new instance of Request. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewRequest(t interface { mock.TestingT Cleanup(func()) -} - -// NewRequest creates a new instance of Request. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewRequest(t mockConstructorTestingTNewRequest) *Request { +}) *Request { mock := &Request{} mock.Mock.Test(t) diff --git a/contracts/http/request.go b/contracts/http/request.go index 139ea1251..7e5a6f535 100644 --- a/contracts/http/request.go +++ b/contracts/http/request.go @@ -41,6 +41,8 @@ type Request interface { // Input Retrieve data by order: json, form, query, route Input(key string, defaultValue ...string) string + InputArray(key string, defaultValue ...[]string) []string + InputMap(key string, defaultValue ...map[string]string) map[string]string InputInt(key string, defaultValue ...int) int InputInt64(key string, defaultValue ...int64) int64 InputBool(key string, defaultValue ...bool) bool