Update direct dependencies where possible

This commit is contained in:
Duco van Amstel
2018-11-18 17:55:05 +00:00
committed by Wim
parent f716b8fc0f
commit 09875fe160
356 changed files with 27318 additions and 11078 deletions

View File

@@ -206,6 +206,13 @@ const (
indexPage = "index.html"
)
func (c *context) writeContentType(value string) {
header := c.Response().Header()
if header.Get(HeaderContentType) == "" {
header.Set(HeaderContentType, value)
}
}
func (c *context) Request() *http.Request {
return c.request
}
@@ -430,7 +437,7 @@ func (c *context) JSONP(code int, callback string, i interface{}) (err error) {
}
func (c *context) JSONPBlob(code int, callback string, b []byte) (err error) {
c.response.Header().Set(HeaderContentType, MIMEApplicationJavaScriptCharsetUTF8)
c.writeContentType(MIMEApplicationJavaScriptCharsetUTF8)
c.response.WriteHeader(code)
if _, err = c.response.Write([]byte(callback + "(")); err != nil {
return
@@ -463,7 +470,7 @@ func (c *context) XMLPretty(code int, i interface{}, indent string) (err error)
}
func (c *context) XMLBlob(code int, b []byte) (err error) {
c.response.Header().Set(HeaderContentType, MIMEApplicationXMLCharsetUTF8)
c.writeContentType(MIMEApplicationXMLCharsetUTF8)
c.response.WriteHeader(code)
if _, err = c.response.Write([]byte(xml.Header)); err != nil {
return
@@ -473,14 +480,14 @@ func (c *context) XMLBlob(code int, b []byte) (err error) {
}
func (c *context) Blob(code int, contentType string, b []byte) (err error) {
c.response.Header().Set(HeaderContentType, contentType)
c.writeContentType(contentType)
c.response.WriteHeader(code)
_, err = c.response.Write(b)
return
}
func (c *context) Stream(code int, contentType string, r io.Reader) (err error) {
c.response.Header().Set(HeaderContentType, contentType)
c.writeContentType(contentType)
c.response.WriteHeader(code)
_, err = io.Copy(c.response, r)
return
@@ -509,18 +516,17 @@ func (c *context) File(file string) (err error) {
return
}
func (c *context) Attachment(file, name string) (err error) {
func (c *context) Attachment(file, name string) error {
return c.contentDisposition(file, name, "attachment")
}
func (c *context) Inline(file, name string) (err error) {
func (c *context) Inline(file, name string) error {
return c.contentDisposition(file, name, "inline")
}
func (c *context) contentDisposition(file, name, dispositionType string) (err error) {
func (c *context) contentDisposition(file, name, dispositionType string) error {
c.response.Header().Set(HeaderContentDisposition, fmt.Sprintf("%s; filename=%q", dispositionType, name))
c.File(file)
return
return c.File(file)
}
func (c *context) NoContent(code int) error {