summaryrefslogtreecommitdiffstats
path: root/vendor
diff options
context:
space:
mode:
Diffstat (limited to 'vendor')
-rw-r--r--vendor/gopkg.in/macaron.v1/context.go4
-rw-r--r--vendor/gopkg.in/macaron.v1/macaron.go4
-rw-r--r--vendor/gopkg.in/macaron.v1/response_writer.go13
-rw-r--r--vendor/gopkg.in/macaron.v1/router.go5
4 files changed, 16 insertions, 10 deletions
diff --git a/vendor/gopkg.in/macaron.v1/context.go b/vendor/gopkg.in/macaron.v1/context.go
index 94a8c45d7d..063f9e0148 100644
--- a/vendor/gopkg.in/macaron.v1/context.go
+++ b/vendor/gopkg.in/macaron.v1/context.go
@@ -262,7 +262,7 @@ func (ctx *Context) Params(name string) string {
// SetParams sets value of param with given name.
func (ctx *Context) SetParams(name, val string) {
- if !strings.HasPrefix(name, ":") {
+ if name != "*" && !strings.HasPrefix(name, ":") {
name = ":" + name
}
ctx.params[name] = val
@@ -270,7 +270,7 @@ func (ctx *Context) SetParams(name, val string) {
// ReplaceAllParams replace all current params with given params
func (ctx *Context) ReplaceAllParams(params Params) {
- ctx.params = params;
+ ctx.params = params
}
// ParamsEscape returns escapred params result.
diff --git a/vendor/gopkg.in/macaron.v1/macaron.go b/vendor/gopkg.in/macaron.v1/macaron.go
index 5926e61368..715076ac13 100644
--- a/vendor/gopkg.in/macaron.v1/macaron.go
+++ b/vendor/gopkg.in/macaron.v1/macaron.go
@@ -32,7 +32,7 @@ import (
"github.com/go-macaron/inject"
)
-const _VERSION = "1.2.4.1123"
+const _VERSION = "1.3.2.1216"
func Version() string {
return _VERSION
@@ -194,7 +194,7 @@ func (m *Macaron) createContext(rw http.ResponseWriter, req *http.Request) *Cont
index: 0,
Router: m.Router,
Req: Request{req},
- Resp: NewResponseWriter(rw),
+ Resp: NewResponseWriter(req.Method, rw),
Render: &DummyRender{rw},
Data: make(map[string]interface{}),
}
diff --git a/vendor/gopkg.in/macaron.v1/response_writer.go b/vendor/gopkg.in/macaron.v1/response_writer.go
index ab54f56c03..9133948f9b 100644
--- a/vendor/gopkg.in/macaron.v1/response_writer.go
+++ b/vendor/gopkg.in/macaron.v1/response_writer.go
@@ -42,11 +42,12 @@ type ResponseWriter interface {
type BeforeFunc func(ResponseWriter)
// NewResponseWriter creates a ResponseWriter that wraps an http.ResponseWriter
-func NewResponseWriter(rw http.ResponseWriter) ResponseWriter {
- return &responseWriter{rw, 0, 0, nil}
+func NewResponseWriter(method string, rw http.ResponseWriter) ResponseWriter {
+ return &responseWriter{method, rw, 0, 0, nil}
}
type responseWriter struct {
+ method string
http.ResponseWriter
status int
size int
@@ -59,13 +60,15 @@ func (rw *responseWriter) WriteHeader(s int) {
rw.status = s
}
-func (rw *responseWriter) Write(b []byte) (int, error) {
+func (rw *responseWriter) Write(b []byte) (size int, err error) {
if !rw.Written() {
// The status will be StatusOK if WriteHeader has not been called yet
rw.WriteHeader(http.StatusOK)
}
- size, err := rw.ResponseWriter.Write(b)
- rw.size += size
+ if rw.method != "HEAD" {
+ size, err = rw.ResponseWriter.Write(b)
+ rw.size += size
+ }
return size, err
}
diff --git a/vendor/gopkg.in/macaron.v1/router.go b/vendor/gopkg.in/macaron.v1/router.go
index 950c5bcb09..df593d669a 100644
--- a/vendor/gopkg.in/macaron.v1/router.go
+++ b/vendor/gopkg.in/macaron.v1/router.go
@@ -96,7 +96,7 @@ func NewRouter() *Router {
}
// SetAutoHead sets the value who determines whether add HEAD method automatically
-// when GET method is added. Combo router will not be affected by this value.
+// when GET method is added.
func (r *Router) SetAutoHead(v bool) {
r.autoHead = v
}
@@ -341,6 +341,9 @@ func (cr *ComboRouter) route(fn func(string, ...Handler) *Route, method string,
}
func (cr *ComboRouter) Get(h ...Handler) *ComboRouter {
+ if cr.router.autoHead {
+ cr.Head(h...)
+ }
return cr.route(cr.router.Get, "GET", h...)
}