diff --git a/rpc.go b/rpc.go index cd40a6a..fcebc6f 100644 --- a/rpc.go +++ b/rpc.go @@ -256,7 +256,7 @@ func (r *request) Get() error { // Author : go_developer@163.com<白茶清欢> // // Date : 14:24 2022/6/30 -func (r *request) Send(ctx *gin.Context, serviceFlag string, apiFlag string, parameter map[string]interface{}, receiver interface{}) error { +func (r *request) Send(ctx *gin.Context, serviceFlag string, apiFlag string, parameter map[string]interface{}, header map[string]string, receiver interface{}) error { var ( serviceConfig *Service apiConfig *Api @@ -289,8 +289,15 @@ func (r *request) Send(ctx *gin.Context, serviceFlag string, apiFlag string, par fullURL, body = r.getFullURLAndBody(serviceConfig, apiConfig, parameter) logDataList = append(logDataList, zap.String("full_utl", fullURL)) + fullHeader := make(map[string]string) + for k, v := range apiConfig.Header { + fullHeader[k] = v + } + for k, v := range header { + fullHeader[k] = v + } // 获取客户端 - client = r.GetHttpClient(apiConfig.Header, apiConfig.Timeout) + client = r.GetHttpClient(fullHeader, apiConfig.Timeout) var bodyReader io.Reader if nil != body { logDataList = append(logDataList, zap.String("request_body", string(body)))