修复支付网关地址空白字符
This commit is contained in:
@@ -395,7 +395,7 @@ func notifyParamKeys(params map[string]string) []string {
|
||||
}
|
||||
|
||||
func (c *Client) validate() error {
|
||||
if c.cfg.GatewayURL == "" || c.cfg.MerchantID == "" || c.cfg.SignKey == "" {
|
||||
if strings.TrimSpace(c.cfg.GatewayURL) == "" || c.cfg.MerchantID == "" || c.cfg.SignKey == "" {
|
||||
return ErrConfigIncomplete
|
||||
}
|
||||
if c.cfg.SignType != "" && !strings.EqualFold(c.cfg.SignType, "MD5") {
|
||||
@@ -409,7 +409,7 @@ func (c *Client) post(ctx context.Context, params map[string]string) (map[string
|
||||
for key, value := range params {
|
||||
values.Set(key, value)
|
||||
}
|
||||
httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, c.cfg.GatewayURL, strings.NewReader(values.Encode()))
|
||||
httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, strings.TrimSpace(c.cfg.GatewayURL), strings.NewReader(values.Encode()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user