Skip to content

Commit

Permalink
refactor: reset reuse disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
vicanso committed Mar 19, 2019
1 parent f5fa2a1 commit 50b6d78
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func (c *Context) Reset() {
c.m = nil
c.realIP = ""
c.cod = nil
c.reuseDisabled = false
}

// RemoteAddr get remote address
Expand Down
20 changes: 11 additions & 9 deletions context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ func TestReset(t *testing.T) {
Next: func() error {
return nil
},
Params: make(map[string]string),
StatusCode: 200,
Body: make(map[string]string),
BodyBuffer: bytes.NewBufferString("abcd"),
RequestBody: []byte("abcd"),
m: make(map[interface{}]interface{}),
realIP: "abcd",
cod: &Cod{},
Params: make(map[string]string),
StatusCode: 200,
Body: make(map[string]string),
BodyBuffer: bytes.NewBufferString("abcd"),
RequestBody: []byte("abcd"),
m: make(map[interface{}]interface{}),
realIP: "abcd",
cod: &Cod{},
reuseDisabled: true,
}
c.Reset()
if c.Request != nil ||
Expand All @@ -43,7 +44,8 @@ func TestReset(t *testing.T) {
c.RequestBody != nil ||
c.m != nil ||
c.realIP != "" ||
c.cod != nil {
c.cod != nil ||
c.reuseDisabled != false {
t.Fatalf("reset fail")
}
}
Expand Down

0 comments on commit 50b6d78

Please sign in to comment.