Merge pull request #1168 from sagikazarmark/resubmit-1064
Resubmit #1064
Márk Sági-Kazár authored 2 years ago
GitHub committed 2 years ago
75 | 75 |
}
|
76 | 76 |
|
77 | 77 |
// Invalid Authorization header is passed
|
78 | |
md["authorization"] = []string{fmt.Sprintf("%s", signedKey)}
|
|
78 |
md["authorization"] = []string{signedKey}
|
79 | 79 |
ctx = reqFunc(context.Background(), md)
|
80 | 80 |
token = ctx.Value(JWTContextKey)
|
81 | 81 |
if token != nil {
|
181 | 181 |
func (h *Histogram) Print(w io.Writer) {
|
182 | 182 |
h.h.RLock()
|
183 | 183 |
defer h.h.RUnlock()
|
184 | |
fmt.Fprintf(w, h.h.String())
|
|
184 |
fmt.Fprint(w, h.h.String())
|
185 | 185 |
}
|
186 | 186 |
|
187 | 187 |
// safeHistogram exists as gohistogram.Histogram is not goroutine-safe.
|
128 | 128 |
// When an event occurs it just return nil response and error.
|
129 | 129 |
// When an error occur it return a non nil error.
|
130 | 130 |
func (fw *fakeWatcher) Next(context.Context) (*etcd.Response, error) {
|
131 | |
for {
|
132 | |
select {
|
133 | |
case <-fw.event:
|
134 | |
return nil, nil
|
135 | |
case <-fw.err:
|
136 | |
return nil, errors.New("error from underlying etcd watcher")
|
137 | |
default:
|
138 | |
}
|
|
131 |
select {
|
|
132 |
case <-fw.event:
|
|
133 |
return nil, nil
|
|
134 |
case <-fw.err:
|
|
135 |
return nil, errors.New("error from underlying etcd watcher")
|
|
136 |
|
139 | 137 |
}
|
140 | 138 |
}
|
141 | 139 |
|
62 | 62 |
if want, have := sessionTimeout, clientImpl.sessionTimeout; want != have {
|
63 | 63 |
t.Errorf("want %d, have %d", want, have)
|
64 | 64 |
}
|
65 | |
if want, have := payload, clientImpl.rootNodePayload; bytes.Compare(want[0], have[0]) != 0 || bytes.Compare(want[1], have[1]) != 0 {
|
|
65 |
if want, have := payload, clientImpl.rootNodePayload; !bytes.Equal(want[0], have[0]) || !bytes.Equal(want[1], have[1]) {
|
66 | 66 |
t.Errorf("want %s, have %s", want, have)
|
67 | 67 |
}
|
68 | 68 |
|
0 | 0 |
package proto
|
1 | 1 |
|
2 | 2 |
import (
|
|
3 |
"context"
|
3 | 4 |
"io/ioutil"
|
4 | 5 |
"net/http"
|
5 | 6 |
"net/http/httptest"
|
|
13 | 14 |
|
14 | 15 |
r := httptest.NewRequest(http.MethodGet, "/cat", nil)
|
15 | 16 |
|
16 | |
err := EncodeProtoRequest(nil, r, cat)
|
|
17 |
err := EncodeProtoRequest(context.TODO(), r, cat)
|
17 | 18 |
if err != nil {
|
18 | 19 |
t.Errorf("expected no encoding errors but got: %s", err)
|
19 | 20 |
return
|
|
50 | 51 |
|
51 | 52 |
wr := httptest.NewRecorder()
|
52 | 53 |
|
53 | |
err := EncodeProtoResponse(nil, wr, cat)
|
|
54 |
err := EncodeProtoResponse(context.TODO(), wr, cat)
|
54 | 55 |
if err != nil {
|
55 | 56 |
t.Errorf("expected no encoding errors but got: %s", err)
|
56 | 57 |
return
|