File tree 4 files changed +6
-26
lines changed
4 files changed +6
-26
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -101,10 +101,8 @@ type ValueBinder struct {
101
101
// QueryParamsBinder creates query parameter value binder
102
102
func QueryParamsBinder (c Context ) * ValueBinder {
103
103
return & ValueBinder {
104
- failFast : true ,
105
- ValueFunc : func (sourceParam string ) string {
106
- return c .QueryParam (sourceParam )
107
- },
104
+ failFast : true ,
105
+ ValueFunc : c .QueryParam ,
108
106
ValuesFunc : func (sourceParam string ) []string {
109
107
values , ok := c .QueryParams ()[sourceParam ]
110
108
if ! ok {
@@ -119,10 +117,8 @@ func QueryParamsBinder(c Context) *ValueBinder {
119
117
// PathParamsBinder creates path parameter value binder
120
118
func PathParamsBinder (c Context ) * ValueBinder {
121
119
return & ValueBinder {
122
- failFast : true ,
123
- ValueFunc : func (sourceParam string ) string {
124
- return c .Param (sourceParam )
125
- },
120
+ failFast : true ,
121
+ ValueFunc : c .Param ,
126
122
ValuesFunc : func (sourceParam string ) []string {
127
123
// path parameter should not have multiple values so getting values does not make sense but lets not error out here
128
124
value := c .Param (sourceParam )
Original file line number Diff line number Diff line change @@ -263,6 +263,4 @@ func (store *RateLimiterMemoryStore) cleanupStaleVisitors() {
263
263
/*
264
264
actual time method which is mocked in test file
265
265
*/
266
- var now = func () time.Time {
267
- return time .Now ()
268
- }
266
+ var now = time .Now
Original file line number Diff line number Diff line change @@ -350,9 +350,7 @@ func TestRateLimiterMemoryStore_Allow(t *testing.T) {
350
350
351
351
func TestRateLimiterMemoryStore_cleanupStaleVisitors (t * testing.T ) {
352
352
var inMemoryStore = NewRateLimiterMemoryStoreWithConfig (RateLimiterMemoryStoreConfig {Rate : 1 , Burst : 3 })
353
- now = func () time.Time {
354
- return time .Now ()
355
- }
353
+ now = time .Now
356
354
fmt .Println (now ())
357
355
inMemoryStore .visitors = map [string ]* Visitor {
358
356
"A" : {
You can’t perform that action at this time.
0 commit comments