Chore: format code
This commit is contained in:
@@ -436,6 +436,7 @@ func (c *Controller) URLFor(endpoint string, values ...interface{}) string {
|
||||
}
|
||||
return URLFor(endpoint, values...)
|
||||
}
|
||||
|
||||
// Resp sends response based on the Accept Header
|
||||
// By default response will be in JSON
|
||||
func (c *Controller) Resp(data interface{}) error {
|
||||
|
||||
@@ -152,7 +152,6 @@ func (l *limiter) createBucket(key string) bucket {
|
||||
return b
|
||||
}
|
||||
|
||||
|
||||
func defaultSessionKey(r *http.Request) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -94,4 +94,4 @@ func registerGzip() error {
|
||||
)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,4 @@ func NewMockContext(req *http.Request) (*beegoCtx.Context, *HttpResponse) {
|
||||
resp := NewMockHttpResponse()
|
||||
ctx.Reset(resp, req)
|
||||
return ctx, resp
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ func (c *TestController) HelloSession() {
|
||||
c.Ctx.WriteString("set")
|
||||
}
|
||||
|
||||
func (c *TestController) HelloSessionName() {
|
||||
func (c *TestController) HelloSessionName() {
|
||||
name := c.CruSession.Get(context.Background(), "name")
|
||||
c.Ctx.WriteString(name.(string))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ type HttpResponse struct {
|
||||
// NewMockHttpResponse you should only use this in your test code
|
||||
func NewMockHttpResponse() *HttpResponse {
|
||||
return &HttpResponse{
|
||||
body: make([]byte, 0),
|
||||
body: make([]byte, 0),
|
||||
header: make(http.Header),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ func (s *SessionProvider) SessionRegenerate(ctx context.Context, oldsid, sid str
|
||||
|
||||
// SessionDestroy reset Store to nil
|
||||
func (s *SessionProvider) SessionDestroy(ctx context.Context, sid string) error {
|
||||
s.Store = nil;
|
||||
s.Store = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -80,14 +80,13 @@ func (s *SessionProvider) SessionGC(ctx context.Context) {
|
||||
// we do anything since we don't need to mock GC
|
||||
}
|
||||
|
||||
|
||||
type SessionStore struct {
|
||||
sid string
|
||||
sid string
|
||||
values map[interface{}]interface{}
|
||||
}
|
||||
|
||||
func (s *SessionStore) Set(ctx context.Context, key, value interface{}) error {
|
||||
s.values[key]=value
|
||||
s.values[key] = value
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -116,10 +115,7 @@ func (s *SessionStore) Flush(ctx context.Context) error {
|
||||
|
||||
func newSessionStore() *SessionStore {
|
||||
return &SessionStore{
|
||||
sid: uuid.New().String(),
|
||||
sid: uuid.New().String(),
|
||||
values: make(map[interface{}]interface{}, 4),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -45,4 +45,3 @@ func TestSessionProvider(t *testing.T) {
|
||||
|
||||
assert.Equal(t, "Tom", result)
|
||||
}
|
||||
|
||||
|
||||
@@ -738,7 +738,7 @@ func (p *ControllerRegister) AddAutoPrefix(prefix string, c ControllerInterface)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *ControllerRegister) addAutoPrefixMethod(prefix, controllerName, methodName string, ctrl reflect.Type) {
|
||||
func (p *ControllerRegister) addAutoPrefixMethod(prefix, controllerName, methodName string, ctrl reflect.Type) {
|
||||
pattern := path.Join(prefix, strings.ToLower(controllerName), strings.ToLower(methodName), "*")
|
||||
patternInit := path.Join(prefix, controllerName, methodName, "*")
|
||||
patternFix := path.Join(prefix, strings.ToLower(controllerName), strings.ToLower(methodName))
|
||||
|
||||
Reference in New Issue
Block a user