diff --git a/go.mod b/go.mod index 62bc45c..65733a3 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module go.unistack.org/micro-client-http/v4 go 1.19 -require go.unistack.org/micro/v4 v4.0.6 +require go.unistack.org/micro/v4 v4.0.18 diff --git a/go.sum b/go.sum index 979a288..03a7fae 100644 --- a/go.sum +++ b/go.sum @@ -2,3 +2,5 @@ go.unistack.org/micro/v4 v4.0.1 h1:xo1IxbVfgh8i0eY0VeYa3cbb13u5n/Mxnp3FOgWD4Jo= go.unistack.org/micro/v4 v4.0.1/go.mod h1:p/J5UcSJjfHsWGT31uKoghQ5rUQZzQJBAFy+Z4+ZVMs= go.unistack.org/micro/v4 v4.0.6 h1:YFWvTh3VwyOd6NHYTQcf47n2TF5+p/EhpnbuBQX3qhk= go.unistack.org/micro/v4 v4.0.6/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk= +go.unistack.org/micro/v4 v4.0.18 h1:b7WFwem8Nz1xBrRg5FeLnm9CE5gJseHyf9j0BhkiXW0= +go.unistack.org/micro/v4 v4.0.18/go.mod h1:5+da5r835gP0WnNZbYUJDCvWpJ9Xc3IEGyp62e8o8R4= diff --git a/http.go b/http.go index b5f2ebf..bb83d6c 100644 --- a/http.go +++ b/http.go @@ -139,7 +139,7 @@ func newRequest(ctx context.Context, log logger.Logger, addr string, req client. if opts.Context != nil { if md, ok := opts.Context.Value(metadataKey{}).(metadata.Metadata); ok { for k, v := range md { - header.Set(k, v) + header[k] = v } } } @@ -148,13 +148,13 @@ func newRequest(ctx context.Context, log logger.Logger, addr string, req client. } if opts.RequestMetadata != nil { for k, v := range opts.RequestMetadata { - header.Set(k, v) + header[k] = v } } if md, ok := metadata.FromOutgoingContext(ctx); ok { for k, v := range md { - header.Set(k, v) + header[k] = v } } @@ -216,7 +216,7 @@ func newRequest(ctx context.Context, log logger.Logger, addr string, req client. } if log.V(logger.DebugLevel) { - log.Debugf(ctx, "request %s to %s with headers %v body %s", method, u.String(), hreq.Header, b) + log.Debug(ctx, fmt.Sprintf("request %s to %s with headers %v body %s", method, u.String(), hreq.Header, b)) } return hreq, nil diff --git a/stream.go b/stream.go index fbd0d8c..2a69b89 100644 --- a/stream.go +++ b/stream.go @@ -134,14 +134,14 @@ func (h *httpStream) parseRsp(ctx context.Context, log logger.Logger, hrsp *http buf, err = io.ReadAll(hrsp.Body) if err != nil { if log.V(logger.ErrorLevel) { - log.Errorf(ctx, "failed to read body: %v", err) + log.Error(ctx, "failed to read body", err) } return errors.InternalServerError("go.micro.client", string(buf)) } } if log.V(logger.DebugLevel) { - log.Debugf(ctx, "response %s with %v", buf, hrsp.Header) + log.Debug(ctx, fmt.Sprintf("response %s with %v", buf, hrsp.Header)) } if hrsp.StatusCode < 400 { diff --git a/util.go b/util.go index 0a59021..4d4edd7 100644 --- a/util.go +++ b/util.go @@ -274,7 +274,7 @@ func (h *httpClient) parseRsp(ctx context.Context, hrsp *http.Response, rsp inte buf, err = io.ReadAll(hrsp.Body) if err != nil { if h.opts.Logger.V(logger.ErrorLevel) { - h.opts.Logger.Errorf(ctx, "failed to read body: %v", err) + h.opts.Logger.Error(ctx, "failed to read body", err) } return errors.InternalServerError("go.micro.client", string(buf)) } @@ -283,13 +283,13 @@ func (h *httpClient) parseRsp(ctx context.Context, hrsp *http.Response, rsp inte cf, cerr := h.newCodec(ct) if cerr != nil { if h.opts.Logger.V(logger.DebugLevel) { - h.opts.Logger.Debugf(ctx, "response with %v unknown content-type %s %s", hrsp.Header, ct, buf) + h.opts.Logger.Debug(ctx, fmt.Sprintf("response with %v unknown content-type %s %s", hrsp.Header, ct, buf)) } return errors.InternalServerError("go.micro.client", cerr.Error()) } if h.opts.Logger.V(logger.DebugLevel) { - h.opts.Logger.Debugf(ctx, "response %s with %v", buf, hrsp.Header) + h.opts.Logger.Debug(ctx, fmt.Sprintf("response %s with %v", buf, hrsp.Header)) } // succeseful response