Skip to content

Commit 513d882

Browse files
committed
Merge branch 'hotfix-0.2.6'
2 parents fdeba8a + 6048c16 commit 513d882

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ Date: Sun, 17 Aug 2014 13:26:05 GMT
140140
Content-Length: 143
141141

142142
{
143+
"duration": 5356123
143144
"took": "5.356ms",
144145
"data": {
145146
"Database settings": {

control.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ type Param struct {
4545

4646
// Header is used to prepare a JSON header with duration triggered by UserTimer() method
4747
type Header struct {
48-
Took string `json:"took"`
49-
Data interface{} `json:"data"`
48+
Duration time.Duration `json:"duration"`
49+
Took string `json:"took"`
50+
Data interface{} `json:"data"`
5051
}
5152

5253
// Get returns the first value associated with the given name.
@@ -87,7 +88,8 @@ func (c *Control) Body(data interface{}) {
8788
content = []byte(str)
8889
} else {
8990
if !c.timer.IsZero() {
90-
data = &Header{Took: time.Since(c.timer).String(), Data: data}
91+
took := time.Now()
92+
data = &Header{Duration: took.Sub(c.timer), Took: took.Sub(c.timer).String(), Data: data}
9193
}
9294
jsn, err := json.MarshalIndent(data, "", " ")
9395
if err != nil {

router.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// license that can be found in the LICENSE file.
44

55
/*
6-
Package router 0.2.5 provides fast HTTP request router.
6+
Package router 0.2.6 provides fast HTTP request router.
77
88
The router matches incoming requests by the request method and the path.
99
If a handle is registered for this path and method, the router delegates the

0 commit comments

Comments
 (0)