• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pusher / pusher-http-go / 12285846667

11 Dec 2024 10:17PM UTC coverage: 87.082%. Remained the same
12285846667

Pull #93

github

web-flow
Bump golang.org/x/crypto

Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20200709230013-948cd5f35899 to 0.31.0.
- [Commits](https://github.com/golang/crypto/commits/v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #93: Bump golang.org/x/crypto from 0.0.0-20200709230013-948cd5f35899 to 0.31.0

573 of 658 relevant lines covered (87.08%)

1.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/request_url.go
1
package pusher
2

3
import (
4
        "net/url"
5
        "strings"
6
)
7

8
const authVersion = "1.0"
9

10
func unsignedParams(key, timestamp string, body []byte, parameters map[string]string) url.Values {
2✔
11
        params := url.Values{
2✔
12
                "auth_key":       {key},
2✔
13
                "auth_timestamp": {timestamp},
2✔
14
                "auth_version":   {authVersion},
2✔
15
        }
2✔
16

2✔
17
        if body != nil {
4✔
18
                params.Add("body_md5", md5Signature(body))
2✔
19
        }
2✔
20

21
        if parameters != nil {
4✔
22
                for key, values := range parameters {
4✔
23
                        params.Add(key, values)
2✔
24
                }
2✔
25
        }
26

27
        return params
2✔
28

29
}
30

31
func unescapeURL(_url url.Values) string {
2✔
32
        unesc, _ := url.QueryUnescape(_url.Encode())
2✔
33
        return unesc
2✔
34
}
2✔
35

36
func createRequestURL(method, host, path, key, secret, timestamp string, secure bool, body []byte, parameters map[string]string, cluster string) (string, error) {
2✔
37
        params := unsignedParams(key, timestamp, body, parameters)
2✔
38

2✔
39
        stringToSign := strings.Join([]string{method, path, unescapeURL(params)}, "\n")
2✔
40

2✔
41
        authSignature := hmacSignature(stringToSign, secret)
2✔
42

2✔
43
        params.Add("auth_signature", authSignature)
2✔
44

2✔
45
        if host == "" {
4✔
46
                if cluster != "" {
4✔
47
                        host = "api-" + cluster + ".pusher.com"
2✔
48
                } else {
4✔
49
                        host = "api.pusherapp.com"
2✔
50
                }
2✔
51
        }
52
        var base string
2✔
53
        if secure {
4✔
54
                base = "https://"
2✔
55
        } else {
4✔
56
                base = "http://"
2✔
57
        }
2✔
58
        base += host
2✔
59

2✔
60
        endpoint, err := url.ParseRequestURI(base + path)
2✔
61
        if err != nil {
4✔
62
                return "", err
2✔
63
        }
2✔
64
        endpoint.RawQuery = unescapeURL(params)
2✔
65

2✔
66
        return endpoint.String(), nil
2✔
67
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc