Skip to content

Commit

Permalink
Merge branch 'hotfix-0.2.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
takama committed Sep 3, 2014
2 parents fdeba8a + 6048c16 commit 513d882
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Date: Sun, 17 Aug 2014 13:26:05 GMT
Content-Length: 143

{
"duration": 5356123
"took": "5.356ms",
"data": {
"Database settings": {
Expand Down
8 changes: 5 additions & 3 deletions control.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ type Param struct {

// Header is used to prepare a JSON header with duration triggered by UserTimer() method
type Header struct {
Took string `json:"took"`
Data interface{} `json:"data"`
Duration time.Duration `json:"duration"`
Took string `json:"took"`
Data interface{} `json:"data"`
}

// Get returns the first value associated with the given name.
Expand Down Expand Up @@ -87,7 +88,8 @@ func (c *Control) Body(data interface{}) {
content = []byte(str)
} else {
if !c.timer.IsZero() {
data = &Header{Took: time.Since(c.timer).String(), Data: data}
took := time.Now()
data = &Header{Duration: took.Sub(c.timer), Took: took.Sub(c.timer).String(), Data: data}
}
jsn, err := json.MarshalIndent(data, "", " ")
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion router.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.

/*
Package router 0.2.5 provides fast HTTP request router.
Package router 0.2.6 provides fast HTTP request router.
The router matches incoming requests by the request method and the path.
If a handle is registered for this path and method, the router delegates the
Expand Down

0 comments on commit 513d882

Please sign in to comment.