mirror of
https://github.com/usual2970/certimate.git
synced 2025-07-28 09:08:34 +00:00
style: format code
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"gitlab.ecloud.com/ecloud/ecloudsdkcore/config"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"mime/multipart"
|
||||
@@ -20,6 +19,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"gitlab.ecloud.com/ecloud/ecloudsdkcore/config"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -47,8 +48,10 @@ const (
|
||||
HEADER HttpRequestPosition = "Header"
|
||||
)
|
||||
|
||||
const SdkPortalUrl = "/op-apim-portal/apim/request/sdk"
|
||||
const SdkPortalGatewayUrl = "/api/query/openapi/apim/request/sdk"
|
||||
const (
|
||||
SdkPortalUrl = "/op-apim-portal/apim/request/sdk"
|
||||
SdkPortalGatewayUrl = "/api/query/openapi/apim/request/sdk"
|
||||
)
|
||||
|
||||
// NewAPIClient creates a new API client.
|
||||
func NewAPIClient() *APIClient {
|
||||
@@ -199,7 +202,7 @@ func buildHttpRequest(httpRequest *HttpRequest, config *config.Config) *HttpRequ
|
||||
if v.Kind() == reflect.Ptr {
|
||||
v = v.Elem()
|
||||
}
|
||||
var flag = false
|
||||
flag := false
|
||||
for i := 0; i < reqType.NumField(); i++ {
|
||||
fieldType := reqType.Field(i)
|
||||
value := v.FieldByName(fieldType.Name)
|
||||
@@ -270,7 +273,7 @@ func structToMap(value interface{}) map[string]interface{} {
|
||||
}
|
||||
|
||||
func buildCall(httpRequest *HttpRequest) (request *http.Request) {
|
||||
var url = ""
|
||||
url := ""
|
||||
if len(httpRequest.Url) > 0 {
|
||||
url = httpRequest.Url + SdkPortalUrl
|
||||
} else {
|
||||
@@ -284,12 +287,11 @@ func buildCall(httpRequest *HttpRequest) (request *http.Request) {
|
||||
func prepareRequest(path string, method string,
|
||||
postBody interface{},
|
||||
) (httpRequest *http.Request, err error) {
|
||||
|
||||
var body *bytes.Buffer
|
||||
|
||||
// Detect postBody type and post.
|
||||
if postBody != nil {
|
||||
var contentType = detectContentType(postBody)
|
||||
contentType := detectContentType(postBody)
|
||||
body, err = setBody(postBody, contentType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@@ -52,13 +52,11 @@ type APIPlatformResponseBody struct {
|
||||
}
|
||||
|
||||
func NewAPIResponse(r *http.Response) *APIResponse {
|
||||
|
||||
response := &APIResponse{Response: r}
|
||||
return response
|
||||
}
|
||||
|
||||
func NewAPIResponseWithError(errorMessage string) *APIResponse {
|
||||
|
||||
response := &APIResponse{Message: errorMessage}
|
||||
return response
|
||||
}
|
||||
|
@@ -1,13 +1,9 @@
|
||||
package position
|
||||
|
||||
type Body struct {
|
||||
}
|
||||
type Body struct{}
|
||||
|
||||
type Query struct {
|
||||
}
|
||||
type Query struct{}
|
||||
|
||||
type Path struct {
|
||||
}
|
||||
type Path struct{}
|
||||
|
||||
type Header struct {
|
||||
}
|
||||
type Header struct{}
|
||||
|
Reference in New Issue
Block a user