diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ca2a00 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib +.idea + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ diff --git a/http.go b/http.go index 29ff3fa..cae307c 100644 --- a/http.go +++ b/http.go @@ -51,7 +51,7 @@ type httpClient struct { func newRequest(ctx context.Context, log logger.Logger, addr string, req client.Request, ct string, cf codec.Codec, msg interface{}, opts client.CallOptions) (*http.Request, error) { var tags []string - var parameters map[string]map[string]string + parameters := map[string]map[string]string{} scheme := "http" method := http.MethodPost body := "*" // as like google api http annotation @@ -82,9 +82,6 @@ func newRequest(ctx context.Context, log logger.Logger, addr string, req client. tags = t } if k, ok := opts.Context.Value(headerKey{}).([]string); ok && len(k) > 0 { - if parameters == nil { - parameters = make(map[string]map[string]string) - } m, ok := parameters["header"] if !ok { m = make(map[string]string) @@ -95,9 +92,6 @@ func newRequest(ctx context.Context, log logger.Logger, addr string, req client. } } if k, ok := opts.Context.Value(cookieKey{}).([]string); ok && len(k) > 0 { - if parameters == nil { - parameters = make(map[string]map[string]string) - } m, ok := parameters["cookie"] if !ok { m = make(map[string]string)