add request to personal information
This commit is contained in:
@@ -7,11 +7,11 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func PostRequest(url string, model any, header http.Header) ([]byte, error) {
|
||||
func PostRequest(url string, model any, header http.Header) ([]byte, error, *http.Response) {
|
||||
uJson, err := json.Marshal(model)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, err, nil
|
||||
}
|
||||
|
||||
client := http.Client{}
|
||||
@@ -22,16 +22,16 @@ func PostRequest(url string, model any, header http.Header) ([]byte, error) {
|
||||
resp, err := client.Do(req)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, err, nil
|
||||
}
|
||||
|
||||
data, err := io.ReadAll(resp.Body)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, err, nil
|
||||
}
|
||||
|
||||
return data, nil
|
||||
return data, nil, resp
|
||||
}
|
||||
|
||||
func GetRequest(url string, header http.Header, args ...string) ([]byte, error, *http.Response) {
|
||||
|
||||
Reference in New Issue
Block a user