/
middleware.go
103 lines (81 loc) · 2.89 KB
/
middleware.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// Code generated by mockery v2.13.1. DO NOT EDIT.
package mocks
import (
http "net/http"
mock "github.com/stretchr/testify/mock"
)
// Interceptor is an autogenerated mock type for the Interceptor type
type Interceptor struct {
mock.Mock
}
type Interceptor_Expecter struct {
mock *mock.Mock
}
func (_m *Interceptor) EXPECT() *Interceptor_Expecter {
return &Interceptor_Expecter{mock: &_m.Mock}
}
// Intercept provides a mock function with given fields: _a0, _a1
func (_m *Interceptor) Intercept(_a0 http.ResponseWriter, _a1 *http.Request) {
_m.Called(_a0, _a1)
}
// Interceptor_Intercept_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Intercept'
type Interceptor_Intercept_Call struct {
*mock.Call
}
// Intercept is a helper method to define mock.On call
// - _a0 http.ResponseWriter
// - _a1 *http.Request
func (_e *Interceptor_Expecter) Intercept(_a0 interface{}, _a1 interface{}) *Interceptor_Intercept_Call {
return &Interceptor_Intercept_Call{Call: _e.mock.On("Intercept", _a0, _a1)}
}
func (_c *Interceptor_Intercept_Call) Run(run func(_a0 http.ResponseWriter, _a1 *http.Request)) *Interceptor_Intercept_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(http.ResponseWriter), args[1].(*http.Request))
})
return _c
}
func (_c *Interceptor_Intercept_Call) Return() *Interceptor_Intercept_Call {
_c.Call.Return()
return _c
}
// ShouldIntercept provides a mock function with given fields: _a0
func (_m *Interceptor) ShouldIntercept(_a0 *http.Request) bool {
ret := _m.Called(_a0)
var r0 bool
if rf, ok := ret.Get(0).(func(*http.Request) bool); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// Interceptor_ShouldIntercept_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShouldIntercept'
type Interceptor_ShouldIntercept_Call struct {
*mock.Call
}
// ShouldIntercept is a helper method to define mock.On call
// - _a0 *http.Request
func (_e *Interceptor_Expecter) ShouldIntercept(_a0 interface{}) *Interceptor_ShouldIntercept_Call {
return &Interceptor_ShouldIntercept_Call{Call: _e.mock.On("ShouldIntercept", _a0)}
}
func (_c *Interceptor_ShouldIntercept_Call) Run(run func(_a0 *http.Request)) *Interceptor_ShouldIntercept_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*http.Request))
})
return _c
}
func (_c *Interceptor_ShouldIntercept_Call) Return(_a0 bool) *Interceptor_ShouldIntercept_Call {
_c.Call.Return(_a0)
return _c
}
type mockConstructorTestingTNewInterceptor interface {
mock.TestingT
Cleanup(func())
}
// NewInterceptor creates a new instance of Interceptor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewInterceptor(t mockConstructorTestingTNewInterceptor) *Interceptor {
mock := &Interceptor{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}