feat: 网元直连接口-网元配置对端网管信息
This commit is contained in:
@@ -72,15 +72,15 @@ func Post(url string, data url.Values, headers map[string]string) ([]byte, error
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, errors.New(resp.Status)
|
||||
}
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return body, errors.New(resp.Status)
|
||||
}
|
||||
|
||||
return body, nil
|
||||
}
|
||||
|
||||
@@ -110,15 +110,15 @@ func PostJSON(url string, data any, headers map[string]string) ([]byte, error) {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, errors.New(resp.Status)
|
||||
}
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return body, errors.New(resp.Status)
|
||||
}
|
||||
|
||||
return body, nil
|
||||
}
|
||||
|
||||
@@ -199,15 +199,15 @@ func PutJSON(url string, data any, headers map[string]string) ([]byte, error) {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, errors.New(resp.Status)
|
||||
}
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return body, errors.New(resp.Status)
|
||||
}
|
||||
|
||||
return body, nil
|
||||
}
|
||||
|
||||
@@ -230,14 +230,14 @@ func Delete(url string, headers map[string]string) ([]byte, error) {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, errors.New(resp.Status)
|
||||
}
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return body, errors.New(resp.Status)
|
||||
}
|
||||
|
||||
return body, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user