earaujoassis / space
Showing 1 of 4 files from the diff.

@@ -15,7 +15,21 @@
Loading
15 15
// BasicAuthDecode decodes a key-secret pair from a token string, originally used in a
16 16
//      HTTP Basic Authentication strategy (HTTP Request Header)
17 17
func BasicAuthDecode(token string) (string, string) {
18 -
    bytes, _ := base64.StdEncoding.DecodeString(token)
18 +
    bytes, err := base64.StdEncoding.DecodeString(token)
19 +
    if err != nil {
20 +
        return "", ""
21 +
    }
19 22
    values := strings.Split(string(bytes), ":")
23 +
    if len(values) < 2 {
24 +
        return "", ""
25 +
    }
20 26
    return values[0], values[1]
21 27
}
28 +
29 +
// MustServeJSON determines if the HTTP response must be a JSON content or not
30 +
//      using the HTTP request path and the request header attribute `Accept`
31 +
func MustServeJSON(path string, accept string) bool {
32 +
    return strings.HasPrefix(path, "/api") ||
33 +
        strings.HasPrefix(path, "/token") ||
34 +
        strings.HasPrefix(path, "/oauth/token")
35 +
}
Files Coverage
internal 14.30%
test/acceptance/acceptance_utils.go 0.00%
Project Totals (18 files) 14.29%
262.1
TRAVIS_OS_NAME=linux
1.16.5=.16.5
261.1
TRAVIS_OS_NAME=linux
1.16.5=.16.5

No yaml found.

Create your codecov.yml to customize your Codecov experience

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