diff --git a/contracts/http/response.go b/contracts/http/response.go index ab39ef263..1227741c4 100644 --- a/contracts/http/response.go +++ b/contracts/http/response.go @@ -11,7 +11,7 @@ type ContextResponse interface { // Cookie adds a cookie to the response. Cookie(cookie Cookie) ContextResponse // Data write the given data to the response. - Data(code int, contentType string, data []byte) ResponseWithAbort + Data(code int, contentType string, data []byte) Response // Download initiates a file download by specifying the file path and the desired filename Download(filepath, filename string) Response // File serves a file located at the specified file path as the response. @@ -19,16 +19,16 @@ type ContextResponse interface { // Header sets an HTTP header field with the given key and value. Header(key, value string) ContextResponse // Json sends a JSON response with the specified status code and data object. - Json(code int, obj any) ResponseWithAbort + Json(code int, obj any) Response // NoContent sends a response with no-body and the specified status code. - NoContent(code ...int) ResponseWithAbort + NoContent(code ...int) Response // Origin returns the ResponseOrigin Origin() ResponseOrigin // Redirect performs an HTTP redirect to the specified location with the given status code. - Redirect(code int, location string) ResponseWithAbort + Redirect(code int, location string) Response // String writes a string response with the specified status code and format. // The 'values' parameter can be used to replace placeholders in the format string. - String(code int, format string, values ...any) ResponseWithAbort + String(code int, format string, values ...any) Response // Success returns ResponseStatus with a 200 status code. Success() ResponseStatus // Status sets the HTTP response status code and returns the ResponseStatus. @@ -49,11 +49,6 @@ type Response interface { Render() error } -type ResponseWithAbort interface { - Response - Abort() error -} - type StreamWriter interface { // Write writes the specified data to the response. Write(data []byte) (int, error) @@ -67,11 +62,11 @@ type StreamWriter interface { type ResponseStatus interface { // Data write the given data to the Response. - Data(contentType string, data []byte) ResponseWithAbort - // Json sends a JSON AbortResponse with the specified data object. - Json(obj any) ResponseWithAbort - // String writes a string AbortResponse with the specified format and values. - String(format string, values ...any) ResponseWithAbort + Data(contentType string, data []byte) Response + // Json sends a JSON Response with the specified data object. + Json(obj any) Response + // String writes a string Response with the specified format and values. + String(format string, values ...any) Response // Stream sends a streaming response with the specified status code and the given reader. Stream(step func(w StreamWriter) error) Response } diff --git a/http/middleware/throttle_test.go b/http/middleware/throttle_test.go index 433cbc307..8d0e0fd4f 100644 --- a/http/middleware/throttle_test.go +++ b/http/middleware/throttle_test.go @@ -594,7 +594,7 @@ func (r *TestResponse) Cookie(cookie contractshttp.Cookie) contractshttp.Context panic("do not need to implement it") } -func (r *TestResponse) Data(code int, contentType string, data []byte) contractshttp.ResponseWithAbort { +func (r *TestResponse) Data(code int, contentType string, data []byte) contractshttp.Response { panic("do not need to implement it") } @@ -612,11 +612,11 @@ func (r *TestResponse) Header(key, value string) contractshttp.ContextResponse { return r } -func (r *TestResponse) Json(code int, obj any) contractshttp.ResponseWithAbort { +func (r *TestResponse) Json(code int, obj any) contractshttp.Response { panic("do not need to implement it") } -func (r *TestResponse) NoContent(...int) contractshttp.ResponseWithAbort { +func (r *TestResponse) NoContent(...int) contractshttp.Response { panic("do not need to implement it") } @@ -624,11 +624,11 @@ func (r *TestResponse) Origin() contractshttp.ResponseOrigin { panic("do not need to implement it") } -func (r *TestResponse) Redirect(code int, location string) contractshttp.ResponseWithAbort { +func (r *TestResponse) Redirect(code int, location string) contractshttp.Response { panic("do not need to implement it") } -func (r *TestResponse) String(code int, format string, values ...any) contractshttp.ResponseWithAbort { +func (r *TestResponse) String(code int, format string, values ...any) contractshttp.Response { panic("do not need to implement it") } diff --git a/log/logrus_writer_test.go b/log/logrus_writer_test.go index c982f7703..6d5020b9e 100644 --- a/log/logrus_writer_test.go +++ b/log/logrus_writer_test.go @@ -777,7 +777,7 @@ func (r *TestResponse) Cookie(cookie contractshttp.Cookie) contractshttp.Context panic("do not need to implement it") } -func (r *TestResponse) Data(code int, contentType string, data []byte) contractshttp.ResponseWithAbort { +func (r *TestResponse) Data(code int, contentType string, data []byte) contractshttp.Response { panic("do not need to implement it") } @@ -793,11 +793,11 @@ func (r *TestResponse) Header(key, value string) contractshttp.ContextResponse { panic("do not need to implement it") } -func (r *TestResponse) Json(code int, obj any) contractshttp.ResponseWithAbort { +func (r *TestResponse) Json(code int, obj any) contractshttp.Response { panic("do not need to implement it") } -func (r *TestResponse) NoContent(...int) contractshttp.ResponseWithAbort { +func (r *TestResponse) NoContent(...int) contractshttp.Response { panic("do not need to implement it") } @@ -805,11 +805,11 @@ func (r *TestResponse) Origin() contractshttp.ResponseOrigin { return &TestResponseOrigin{ctx: r} } -func (r *TestResponse) Redirect(code int, location string) contractshttp.ResponseWithAbort { +func (r *TestResponse) Redirect(code int, location string) contractshttp.Response { panic("do not need to implement it") } -func (r *TestResponse) String(code int, format string, values ...any) contractshttp.ResponseWithAbort { +func (r *TestResponse) String(code int, format string, values ...any) contractshttp.Response { panic("do not need to implement it") } diff --git a/mocks/http/AbortResponse.go b/mocks/http/AbortResponse.go deleted file mode 100644 index 18ad7bb9c..000000000 --- a/mocks/http/AbortResponse.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by mockery. DO NOT EDIT. - -package http - -import mock "github.com/stretchr/testify/mock" - -// AbortResponse is an autogenerated mock type for the AbortResponse type -type AbortResponse struct { - mock.Mock -} - -type AbortResponse_Expecter struct { - mock *mock.Mock -} - -func (_m *AbortResponse) EXPECT() *AbortResponse_Expecter { - return &AbortResponse_Expecter{mock: &_m.Mock} -} - -// Abort provides a mock function with given fields: -func (_m *AbortResponse) Abort() error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Abort") - } - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// AbortResponse_Abort_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Abort' -type AbortResponse_Abort_Call struct { - *mock.Call -} - -// Abort is a helper method to define mock.On call -func (_e *AbortResponse_Expecter) Abort() *AbortResponse_Abort_Call { - return &AbortResponse_Abort_Call{Call: _e.mock.On("Abort")} -} - -func (_c *AbortResponse_Abort_Call) Run(run func()) *AbortResponse_Abort_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *AbortResponse_Abort_Call) Return(_a0 error) *AbortResponse_Abort_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *AbortResponse_Abort_Call) RunAndReturn(run func() error) *AbortResponse_Abort_Call { - _c.Call.Return(run) - return _c -} - -// Render provides a mock function with given fields: -func (_m *AbortResponse) Render() error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Render") - } - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// AbortResponse_Render_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Render' -type AbortResponse_Render_Call struct { - *mock.Call -} - -// Render is a helper method to define mock.On call -func (_e *AbortResponse_Expecter) Render() *AbortResponse_Render_Call { - return &AbortResponse_Render_Call{Call: _e.mock.On("Render")} -} - -func (_c *AbortResponse_Render_Call) Run(run func()) *AbortResponse_Render_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *AbortResponse_Render_Call) Return(_a0 error) *AbortResponse_Render_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *AbortResponse_Render_Call) RunAndReturn(run func() error) *AbortResponse_Render_Call { - _c.Call.Return(run) - return _c -} - -// NewAbortResponse creates a new instance of AbortResponse. 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 NewAbortResponse(t interface { - mock.TestingT - Cleanup(func()) -}) *AbortResponse { - mock := &AbortResponse{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/http/ContextResponse.go b/mocks/http/ContextResponse.go index f84d34866..d753cdf36 100644 --- a/mocks/http/ContextResponse.go +++ b/mocks/http/ContextResponse.go @@ -71,19 +71,19 @@ func (_c *ContextResponse_Cookie_Call) RunAndReturn(run func(http.Cookie) http.C } // Data provides a mock function with given fields: code, contentType, data -func (_m *ContextResponse) Data(code int, contentType string, data []byte) http.ResponseWithAbort { +func (_m *ContextResponse) Data(code int, contentType string, data []byte) http.Response { ret := _m.Called(code, contentType, data) if len(ret) == 0 { panic("no return value specified for Data") } - var r0 http.ResponseWithAbort - if rf, ok := ret.Get(0).(func(int, string, []byte) http.ResponseWithAbort); ok { + var r0 http.Response + if rf, ok := ret.Get(0).(func(int, string, []byte) http.Response); ok { r0 = rf(code, contentType, data) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(http.ResponseWithAbort) + r0 = ret.Get(0).(http.Response) } } @@ -110,12 +110,12 @@ func (_c *ContextResponse_Data_Call) Run(run func(code int, contentType string, return _c } -func (_c *ContextResponse_Data_Call) Return(_a0 http.ResponseWithAbort) *ContextResponse_Data_Call { +func (_c *ContextResponse_Data_Call) Return(_a0 http.Response) *ContextResponse_Data_Call { _c.Call.Return(_a0) return _c } -func (_c *ContextResponse_Data_Call) RunAndReturn(run func(int, string, []byte) http.ResponseWithAbort) *ContextResponse_Data_Call { +func (_c *ContextResponse_Data_Call) RunAndReturn(run func(int, string, []byte) http.Response) *ContextResponse_Data_Call { _c.Call.Return(run) return _c } @@ -299,19 +299,19 @@ func (_c *ContextResponse_Header_Call) RunAndReturn(run func(string, string) htt } // Json provides a mock function with given fields: code, obj -func (_m *ContextResponse) Json(code int, obj interface{}) http.ResponseWithAbort { +func (_m *ContextResponse) Json(code int, obj interface{}) http.Response { ret := _m.Called(code, obj) if len(ret) == 0 { panic("no return value specified for Json") } - var r0 http.ResponseWithAbort - if rf, ok := ret.Get(0).(func(int, interface{}) http.ResponseWithAbort); ok { + var r0 http.Response + if rf, ok := ret.Get(0).(func(int, interface{}) http.Response); ok { r0 = rf(code, obj) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(http.ResponseWithAbort) + r0 = ret.Get(0).(http.Response) } } @@ -337,18 +337,18 @@ func (_c *ContextResponse_Json_Call) Run(run func(code int, obj interface{})) *C return _c } -func (_c *ContextResponse_Json_Call) Return(_a0 http.ResponseWithAbort) *ContextResponse_Json_Call { +func (_c *ContextResponse_Json_Call) Return(_a0 http.Response) *ContextResponse_Json_Call { _c.Call.Return(_a0) return _c } -func (_c *ContextResponse_Json_Call) RunAndReturn(run func(int, interface{}) http.ResponseWithAbort) *ContextResponse_Json_Call { +func (_c *ContextResponse_Json_Call) RunAndReturn(run func(int, interface{}) http.Response) *ContextResponse_Json_Call { _c.Call.Return(run) return _c } // NoContent provides a mock function with given fields: code -func (_m *ContextResponse) NoContent(code ...int) http.ResponseWithAbort { +func (_m *ContextResponse) NoContent(code ...int) http.Response { _va := make([]interface{}, len(code)) for _i := range code { _va[_i] = code[_i] @@ -361,12 +361,12 @@ func (_m *ContextResponse) NoContent(code ...int) http.ResponseWithAbort { panic("no return value specified for NoContent") } - var r0 http.ResponseWithAbort - if rf, ok := ret.Get(0).(func(...int) http.ResponseWithAbort); ok { + var r0 http.Response + if rf, ok := ret.Get(0).(func(...int) http.Response); ok { r0 = rf(code...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(http.ResponseWithAbort) + r0 = ret.Get(0).(http.Response) } } @@ -398,12 +398,12 @@ func (_c *ContextResponse_NoContent_Call) Run(run func(code ...int)) *ContextRes return _c } -func (_c *ContextResponse_NoContent_Call) Return(_a0 http.ResponseWithAbort) *ContextResponse_NoContent_Call { +func (_c *ContextResponse_NoContent_Call) Return(_a0 http.Response) *ContextResponse_NoContent_Call { _c.Call.Return(_a0) return _c } -func (_c *ContextResponse_NoContent_Call) RunAndReturn(run func(...int) http.ResponseWithAbort) *ContextResponse_NoContent_Call { +func (_c *ContextResponse_NoContent_Call) RunAndReturn(run func(...int) http.Response) *ContextResponse_NoContent_Call { _c.Call.Return(run) return _c } @@ -456,19 +456,19 @@ func (_c *ContextResponse_Origin_Call) RunAndReturn(run func() http.ResponseOrig } // Redirect provides a mock function with given fields: code, location -func (_m *ContextResponse) Redirect(code int, location string) http.ResponseWithAbort { +func (_m *ContextResponse) Redirect(code int, location string) http.Response { ret := _m.Called(code, location) if len(ret) == 0 { panic("no return value specified for Redirect") } - var r0 http.ResponseWithAbort - if rf, ok := ret.Get(0).(func(int, string) http.ResponseWithAbort); ok { + var r0 http.Response + if rf, ok := ret.Get(0).(func(int, string) http.Response); ok { r0 = rf(code, location) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(http.ResponseWithAbort) + r0 = ret.Get(0).(http.Response) } } @@ -494,12 +494,12 @@ func (_c *ContextResponse_Redirect_Call) Run(run func(code int, location string) return _c } -func (_c *ContextResponse_Redirect_Call) Return(_a0 http.ResponseWithAbort) *ContextResponse_Redirect_Call { +func (_c *ContextResponse_Redirect_Call) Return(_a0 http.Response) *ContextResponse_Redirect_Call { _c.Call.Return(_a0) return _c } -func (_c *ContextResponse_Redirect_Call) RunAndReturn(run func(int, string) http.ResponseWithAbort) *ContextResponse_Redirect_Call { +func (_c *ContextResponse_Redirect_Call) RunAndReturn(run func(int, string) http.Response) *ContextResponse_Redirect_Call { _c.Call.Return(run) return _c } @@ -602,7 +602,7 @@ func (_c *ContextResponse_Stream_Call) RunAndReturn(run func(int, func(http.Stre } // String provides a mock function with given fields: code, format, values -func (_m *ContextResponse) String(code int, format string, values ...interface{}) http.ResponseWithAbort { +func (_m *ContextResponse) String(code int, format string, values ...interface{}) http.Response { var _ca []interface{} _ca = append(_ca, code, format) _ca = append(_ca, values...) @@ -612,12 +612,12 @@ func (_m *ContextResponse) String(code int, format string, values ...interface{} panic("no return value specified for String") } - var r0 http.ResponseWithAbort - if rf, ok := ret.Get(0).(func(int, string, ...interface{}) http.ResponseWithAbort); ok { + var r0 http.Response + if rf, ok := ret.Get(0).(func(int, string, ...interface{}) http.Response); ok { r0 = rf(code, format, values...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(http.ResponseWithAbort) + r0 = ret.Get(0).(http.Response) } } @@ -651,12 +651,12 @@ func (_c *ContextResponse_String_Call) Run(run func(code int, format string, val return _c } -func (_c *ContextResponse_String_Call) Return(_a0 http.ResponseWithAbort) *ContextResponse_String_Call { +func (_c *ContextResponse_String_Call) Return(_a0 http.Response) *ContextResponse_String_Call { _c.Call.Return(_a0) return _c } -func (_c *ContextResponse_String_Call) RunAndReturn(run func(int, string, ...interface{}) http.ResponseWithAbort) *ContextResponse_String_Call { +func (_c *ContextResponse_String_Call) RunAndReturn(run func(int, string, ...interface{}) http.Response) *ContextResponse_String_Call { _c.Call.Return(run) return _c } diff --git a/mocks/http/ResponseStatus.go b/mocks/http/ResponseStatus.go index a4312dc9b..7d99e045e 100644 --- a/mocks/http/ResponseStatus.go +++ b/mocks/http/ResponseStatus.go @@ -21,19 +21,19 @@ func (_m *ResponseStatus) EXPECT() *ResponseStatus_Expecter { } // Data provides a mock function with given fields: contentType, data -func (_m *ResponseStatus) Data(contentType string, data []byte) http.ResponseWithAbort { +func (_m *ResponseStatus) Data(contentType string, data []byte) http.Response { ret := _m.Called(contentType, data) if len(ret) == 0 { panic("no return value specified for Data") } - var r0 http.ResponseWithAbort - if rf, ok := ret.Get(0).(func(string, []byte) http.ResponseWithAbort); ok { + var r0 http.Response + if rf, ok := ret.Get(0).(func(string, []byte) http.Response); ok { r0 = rf(contentType, data) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(http.ResponseWithAbort) + r0 = ret.Get(0).(http.Response) } } @@ -59,30 +59,30 @@ func (_c *ResponseStatus_Data_Call) Run(run func(contentType string, data []byte return _c } -func (_c *ResponseStatus_Data_Call) Return(_a0 http.ResponseWithAbort) *ResponseStatus_Data_Call { +func (_c *ResponseStatus_Data_Call) Return(_a0 http.Response) *ResponseStatus_Data_Call { _c.Call.Return(_a0) return _c } -func (_c *ResponseStatus_Data_Call) RunAndReturn(run func(string, []byte) http.ResponseWithAbort) *ResponseStatus_Data_Call { +func (_c *ResponseStatus_Data_Call) RunAndReturn(run func(string, []byte) http.Response) *ResponseStatus_Data_Call { _c.Call.Return(run) return _c } // Json provides a mock function with given fields: obj -func (_m *ResponseStatus) Json(obj interface{}) http.ResponseWithAbort { +func (_m *ResponseStatus) Json(obj interface{}) http.Response { ret := _m.Called(obj) if len(ret) == 0 { panic("no return value specified for Json") } - var r0 http.ResponseWithAbort - if rf, ok := ret.Get(0).(func(interface{}) http.ResponseWithAbort); ok { + var r0 http.Response + if rf, ok := ret.Get(0).(func(interface{}) http.Response); ok { r0 = rf(obj) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(http.ResponseWithAbort) + r0 = ret.Get(0).(http.Response) } } @@ -107,12 +107,12 @@ func (_c *ResponseStatus_Json_Call) Run(run func(obj interface{})) *ResponseStat return _c } -func (_c *ResponseStatus_Json_Call) Return(_a0 http.ResponseWithAbort) *ResponseStatus_Json_Call { +func (_c *ResponseStatus_Json_Call) Return(_a0 http.Response) *ResponseStatus_Json_Call { _c.Call.Return(_a0) return _c } -func (_c *ResponseStatus_Json_Call) RunAndReturn(run func(interface{}) http.ResponseWithAbort) *ResponseStatus_Json_Call { +func (_c *ResponseStatus_Json_Call) RunAndReturn(run func(interface{}) http.Response) *ResponseStatus_Json_Call { _c.Call.Return(run) return _c } @@ -166,7 +166,7 @@ func (_c *ResponseStatus_Stream_Call) RunAndReturn(run func(func(http.StreamWrit } // String provides a mock function with given fields: format, values -func (_m *ResponseStatus) String(format string, values ...interface{}) http.ResponseWithAbort { +func (_m *ResponseStatus) String(format string, values ...interface{}) http.Response { var _ca []interface{} _ca = append(_ca, format) _ca = append(_ca, values...) @@ -176,12 +176,12 @@ func (_m *ResponseStatus) String(format string, values ...interface{}) http.Resp panic("no return value specified for String") } - var r0 http.ResponseWithAbort - if rf, ok := ret.Get(0).(func(string, ...interface{}) http.ResponseWithAbort); ok { + var r0 http.Response + if rf, ok := ret.Get(0).(func(string, ...interface{}) http.Response); ok { r0 = rf(format, values...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(http.ResponseWithAbort) + r0 = ret.Get(0).(http.Response) } } @@ -214,12 +214,12 @@ func (_c *ResponseStatus_String_Call) Run(run func(format string, values ...inte return _c } -func (_c *ResponseStatus_String_Call) Return(_a0 http.ResponseWithAbort) *ResponseStatus_String_Call { +func (_c *ResponseStatus_String_Call) Return(_a0 http.Response) *ResponseStatus_String_Call { _c.Call.Return(_a0) return _c } -func (_c *ResponseStatus_String_Call) RunAndReturn(run func(string, ...interface{}) http.ResponseWithAbort) *ResponseStatus_String_Call { +func (_c *ResponseStatus_String_Call) RunAndReturn(run func(string, ...interface{}) http.Response) *ResponseStatus_String_Call { _c.Call.Return(run) return _c } diff --git a/mocks/http/ResponseWithAbort.go b/mocks/http/ResponseWithAbort.go deleted file mode 100644 index 8d92e60f2..000000000 --- a/mocks/http/ResponseWithAbort.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by mockery. DO NOT EDIT. - -package http - -import mock "github.com/stretchr/testify/mock" - -// ResponseWithAbort is an autogenerated mock type for the ResponseWithAbort type -type ResponseWithAbort struct { - mock.Mock -} - -type ResponseWithAbort_Expecter struct { - mock *mock.Mock -} - -func (_m *ResponseWithAbort) EXPECT() *ResponseWithAbort_Expecter { - return &ResponseWithAbort_Expecter{mock: &_m.Mock} -} - -// Abort provides a mock function with no fields -func (_m *ResponseWithAbort) Abort() error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Abort") - } - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// ResponseWithAbort_Abort_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Abort' -type ResponseWithAbort_Abort_Call struct { - *mock.Call -} - -// Abort is a helper method to define mock.On call -func (_e *ResponseWithAbort_Expecter) Abort() *ResponseWithAbort_Abort_Call { - return &ResponseWithAbort_Abort_Call{Call: _e.mock.On("Abort")} -} - -func (_c *ResponseWithAbort_Abort_Call) Run(run func()) *ResponseWithAbort_Abort_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *ResponseWithAbort_Abort_Call) Return(_a0 error) *ResponseWithAbort_Abort_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *ResponseWithAbort_Abort_Call) RunAndReturn(run func() error) *ResponseWithAbort_Abort_Call { - _c.Call.Return(run) - return _c -} - -// Render provides a mock function with no fields -func (_m *ResponseWithAbort) Render() error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Render") - } - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// ResponseWithAbort_Render_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Render' -type ResponseWithAbort_Render_Call struct { - *mock.Call -} - -// Render is a helper method to define mock.On call -func (_e *ResponseWithAbort_Expecter) Render() *ResponseWithAbort_Render_Call { - return &ResponseWithAbort_Render_Call{Call: _e.mock.On("Render")} -} - -func (_c *ResponseWithAbort_Render_Call) Run(run func()) *ResponseWithAbort_Render_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *ResponseWithAbort_Render_Call) Return(_a0 error) *ResponseWithAbort_Render_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *ResponseWithAbort_Render_Call) RunAndReturn(run func() error) *ResponseWithAbort_Render_Call { - _c.Call.Return(run) - return _c -} - -// NewResponseWithAbort creates a new instance of ResponseWithAbort. 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 NewResponseWithAbort(t interface { - mock.TestingT - Cleanup(func()) -}) *ResponseWithAbort { - mock := &ResponseWithAbort{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/session/middleware/start_session_test.go b/session/middleware/start_session_test.go index 27d57d52a..c380f8918 100644 --- a/session/middleware/start_session_test.go +++ b/session/middleware/start_session_test.go @@ -338,7 +338,7 @@ func (r *TestResponse) Cookie(cookie contractshttp.Cookie) contractshttp.Context return r } -func (r *TestResponse) Data(int, string, []byte) contractshttp.ResponseWithAbort { +func (r *TestResponse) Data(int, string, []byte) contractshttp.Response { panic("do not need to implement it") } @@ -354,11 +354,11 @@ func (r *TestResponse) Header(string, string) contractshttp.ContextResponse { return r } -func (r *TestResponse) Json(int, any) contractshttp.ResponseWithAbort { +func (r *TestResponse) Json(int, any) contractshttp.Response { panic("do not need to implement it") } -func (r *TestResponse) NoContent(...int) contractshttp.ResponseWithAbort { +func (r *TestResponse) NoContent(...int) contractshttp.Response { panic("do not need to implement it") } @@ -366,11 +366,11 @@ func (r *TestResponse) Origin() contractshttp.ResponseOrigin { panic("do not need to implement it") } -func (r *TestResponse) Redirect(int, string) contractshttp.ResponseWithAbort { +func (r *TestResponse) Redirect(int, string) contractshttp.Response { panic("do not need to implement it") } -func (r *TestResponse) String(int, string, ...any) contractshttp.ResponseWithAbort { +func (r *TestResponse) String(int, string, ...any) contractshttp.Response { panic("do not need to implement it") }