mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
feat: avoid using body in GET requests for AirwallexClient payment provider (#3669)
This commit is contained in:
parent
aafc16e4f4
commit
73c680d56f
@ -4,6 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
@ -180,7 +181,11 @@ func (c *AirwallexClient) authRequest(method, url string, body interface{}) (map
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
b, _ := json.Marshal(body)
|
b, _ := json.Marshal(body)
|
||||||
req, _ := http.NewRequest(method, url, bytes.NewBuffer(b))
|
var reqBody io.Reader
|
||||||
|
if method != "GET" {
|
||||||
|
reqBody = bytes.NewBuffer(b)
|
||||||
|
}
|
||||||
|
req, _ := http.NewRequest(method, url, reqBody)
|
||||||
req.Header.Set("Authorization", "Bearer "+token)
|
req.Header.Set("Authorization", "Bearer "+token)
|
||||||
req.Header.Set("Content-Type", "application/json")
|
req.Header.Set("Content-Type", "application/json")
|
||||||
resp, err := c.client.Do(req)
|
resp, err := c.client.Do(req)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user