v3 #118

Closed
devstigneev wants to merge 2 commits from devstigneev/micro-client-http:v3 into v3
2 changed files with 17 additions and 7 deletions

16
.gitignore vendored Normal file
View File

@ -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/

View File

@ -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) { 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 tags []string
var parameters map[string]map[string]string parameters := map[string]map[string]string{}
scheme := "http" scheme := "http"
method := http.MethodPost method := http.MethodPost
body := "*" // as like google api http annotation 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 tags = t
} }
if k, ok := opts.Context.Value(headerKey{}).([]string); ok && len(k) > 0 { 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"] m, ok := parameters["header"]
if !ok { if !ok {
m = make(map[string]string) 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 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"] m, ok := parameters["cookie"]
if !ok { if !ok {
m = make(map[string]string) m = make(map[string]string)