Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
takama committed Jun 15, 2015
2 parents 09cfc2a + e3f4510 commit 2c080d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions control.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"compress/gzip"
"encoding/json"
"net/http"
"strings"
"time"
)

Expand All @@ -34,9 +35,6 @@ type Control struct {
// CompactJSON propery defines JSON output format (default is not compact)
compactJSON bool

// gzip propery defines compressed output
gzip bool

// Params is set of parameters
Params []Param

Expand Down Expand Up @@ -87,11 +85,6 @@ func (c *Control) CompactJSON(mode bool) {
c.compactJSON = mode
}

// UseGZIP defines compressed output
func (c *Control) UseGZIP(mode bool) {
c.gzip = mode
}

// UseTimer allow caalculate elapsed time of request handling
func (c *Control) UseTimer() {
c.timer = time.Now()
Expand Down Expand Up @@ -120,7 +113,7 @@ func (c *Control) Body(data interface{}) {
}
c.Writer.Header().Add("Content-type", MIMEJSON)
}
if c.gzip {
if strings.Contains(c.Request.Header.Get("Accept-Encoding"), "gzip") {
c.Writer.Header().Add("Content-Encoding", "gzip")
c.Writer.WriteHeader(c.code)
gz := gzip.NewWriter(c.Writer)
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.12 provides fast HTTP request router.
Package router 0.3.0 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 2c080d5

Please sign in to comment.