Codebase list golang-github-go-kit-kit / ab98ef0
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
5 changed file(s) with 12 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
7575 }
7676
7777 // Invalid Authorization header is passed
78 md["authorization"] = []string{fmt.Sprintf("%s", signedKey)}
78 md["authorization"] = []string{signedKey}
7979 ctx = reqFunc(context.Background(), md)
8080 token = ctx.Value(JWTContextKey)
8181 if token != nil {
181181 func (h *Histogram) Print(w io.Writer) {
182182 h.h.RLock()
183183 defer h.h.RUnlock()
184 fmt.Fprintf(w, h.h.String())
184 fmt.Fprint(w, h.h.String())
185185 }
186186
187187 // safeHistogram exists as gohistogram.Histogram is not goroutine-safe.
128128 // When an event occurs it just return nil response and error.
129129 // When an error occur it return a non nil error.
130130 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
139137 }
140138 }
141139
6262 if want, have := sessionTimeout, clientImpl.sessionTimeout; want != have {
6363 t.Errorf("want %d, have %d", want, have)
6464 }
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]) {
6666 t.Errorf("want %s, have %s", want, have)
6767 }
6868
00 package proto
11
22 import (
3 "context"
34 "io/ioutil"
45 "net/http"
56 "net/http/httptest"
1314
1415 r := httptest.NewRequest(http.MethodGet, "/cat", nil)
1516
16 err := EncodeProtoRequest(nil, r, cat)
17 err := EncodeProtoRequest(context.TODO(), r, cat)
1718 if err != nil {
1819 t.Errorf("expected no encoding errors but got: %s", err)
1920 return
5051
5152 wr := httptest.NewRecorder()
5253
53 err := EncodeProtoResponse(nil, wr, cat)
54 err := EncodeProtoResponse(context.TODO(), wr, cat)
5455 if err != nil {
5556 t.Errorf("expected no encoding errors but got: %s", err)
5657 return