Showing 5 of 11 files from the diff.

@@ -90,6 +90,11 @@
Loading
90 90
	return (msg.Type & flags) > 0
91 91
}
92 92
93 +
// Unwrap returns the wrapped error, to allow interoperability with errors.Is(), errors.As() and errors.Unwrap()
94 +
func (msg *Error) Unwrap() error {
95 +
	return msg.Err
96 +
}
97 +
93 98
// ByType returns a readonly copy filtered the byte.
94 99
// ie ByType(gin.ErrorTypePublic) returns a slice of errors with type=ErrorTypePublic.
95 100
func (a errorMsgs) ByType(typ ErrorType) errorMsgs {

@@ -103,7 +103,10 @@
Loading
103 103
	parts := strings.Split(acceptHeader, ",")
104 104
	out := make([]string, 0, len(parts))
105 105
	for _, part := range parts {
106 -
		if part = strings.TrimSpace(strings.Split(part, ";")[0]); part != "" {
106 +
		if i := strings.IndexByte(part, ';'); i > 0 {
107 +
			part = part[:i]
108 +
		}
109 +
		if part = strings.TrimSpace(part); part != "" {
107 110
			out = append(out, part)
108 111
		}
109 112
	}

@@ -76,11 +76,12 @@
Loading
76 76
							headers[idx] = current[0] + ": *"
77 77
						}
78 78
					}
79 +
					headersToStr := strings.Join(headers, "\r\n")
79 80
					if brokenPipe {
80 -
						logger.Printf("%s\n%s%s", err, string(httpRequest), reset)
81 +
						logger.Printf("%s\n%s%s", err, headersToStr, reset)
81 82
					} else if IsDebugging() {
82 83
						logger.Printf("[Recovery] %s panic recovered:\n%s\n%s\n%s%s",
83 -
							timeFormat(time.Now()), strings.Join(headers, "\r\n"), err, stack, reset)
84 +
							timeFormat(time.Now()), headersToStr, err, stack, reset)
84 85
					} else {
85 86
						logger.Printf("[Recovery] %s panic recovered:\n%s\n%s%s",
86 87
							timeFormat(time.Now()), err, stack, reset)

@@ -295,6 +295,22 @@
Loading
295 295
	return
296 296
}
297 297
298 +
// GetUint returns the value associated with the key as an unsigned integer.
299 +
func (c *Context) GetUint(key string) (ui uint) {
300 +
	if val, ok := c.Get(key); ok && val != nil {
301 +
		ui, _ = val.(uint)
302 +
	}
303 +
	return
304 +
}
305 +
306 +
// GetUint64 returns the value associated with the key as an unsigned integer.
307 +
func (c *Context) GetUint64(key string) (ui64 uint64) {
308 +
	if val, ok := c.Get(key); ok && val != nil {
309 +
		ui64, _ = val.(uint64)
310 +
	}
311 +
	return
312 +
}
313 +
298 314
// GetFloat64 returns the value associated with the key as a float64.
299 315
func (c *Context) GetFloat64(key string) (f64 float64) {
300 316
	if val, ok := c.Get(key); ok && val != nil {
@@ -957,7 +973,7 @@
Loading
957 973
	http.ServeFile(c.Writer, c.Request, filepath)
958 974
}
959 975
960 -
// FileFromFS writes the specified file from http.FileSytem into the body stream in an efficient way.
976 +
// FileFromFS writes the specified file from http.FileSystem into the body stream in an efficient way.
961 977
func (c *Context) FileFromFS(filepath string, fs http.FileSystem) {
962 978
	defer func(old string) {
963 979
		c.Request.URL.Path = old
@@ -971,7 +987,7 @@
Loading
971 987
// FileAttachment writes the specified file into the body stream in an efficient way
972 988
// On the client side, the file will typically be downloaded with the given filename
973 989
func (c *Context) FileAttachment(filepath, filename string) {
974 -
	c.Writer.Header().Set("content-disposition", fmt.Sprintf("attachment; filename=\"%s\"", filename))
990 +
	c.Writer.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", filename))
975 991
	http.ServeFile(c.Writer, c.Request, filepath)
976 992
}
977 993

@@ -7,6 +7,8 @@
Loading
7 7
import (
8 8
	"fmt"
9 9
	"net/http"
10 +
11 +
	"github.com/gin-gonic/gin/internal/bytesconv"
10 12
)
11 13
12 14
// String contains the given interface object slice and its format.
@@ -34,6 +36,6 @@
Loading
34 36
		_, err = fmt.Fprintf(w, format, data...)
35 37
		return
36 38
	}
37 -
	_, err = w.Write([]byte(format))
39 +
	_, err = w.Write(bytesconv.StringToBytes(format))
38 40
	return
39 41
}
Files Coverage
binding 100.00%
render 92.96%
auth.go 100.00%
context.go 97.51%
debug.go 92.50%
deprecated.go 100.00%
errors.go 100.00%
fs.go 100.00%
gin.go 99.01%
logger.go 100.00%
mode.go 100.00%
path.go 100.00%
recovery.go 97.18%
response_writer.go 93.33%
routergroup.go 100.00%
test_helpers.go 100.00%
tree.go 100.00%
utils.go 96.83%
Project Totals (41 files) 98.46%
4687.3
1.13.x=.13.x
TRAVIS_OS_NAME=linux
4687.4
1.13.x=.13.x
TRAVIS_OS_NAME=linux
4687.1
1.11.x=.11.x
TRAVIS_OS_NAME=linux
4687.2
TRAVIS_OS_NAME=linux
1.12.x=.12.x
4687.8
TRAVIS_OS_NAME=linux
1.15.x=.15.x
4687.5
1.14.x=.14.x
TRAVIS_OS_NAME=linux
4687.7
TRAVIS_OS_NAME=linux
1.15.x=.15.x
4687.6
1.14.x=.14.x
TRAVIS_OS_NAME=linux
4687.9
TRAVIS_OS_NAME=linux
master=
1
coverage:
2
  notify:
3
    gitter:
4
      default:
5
        url: https://webhooks.gitter.im/e/d90dcdeeab2f1e357165
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading