7
0
gaore-common-sdk-go/sdk/requests/http_request.go
2020-08-05 12:14:49 +08:00

45 lines
908 B
Go

package requests
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils"
"io"
"strings"
)
type HttpRequest struct {
*baseRequest
}
func (request *HttpRequest) init() {
request.baseRequest = defaultBaseRequest()
request.Method = POST
}
func (request *HttpRequest) BuildUrl() string {
return ""
}
func (request *HttpRequest) BuildQueries() string {
return ""
}
func (request *HttpRequest) GetActionName() string {
return request.actionName
}
func (request *HttpRequest) InitWithApiInfo(product, version, action string) {
request.init()
request.product = product
request.version = version
request.actionName = action
}
func (request *HttpRequest) GetBodyReader() io.Reader {
if request.FormParams != nil && len(request.FormParams) > 0 {
formString := utils.GetUrlFormedMap(request.FormParams)
return strings.NewReader(formString)
} else {
return strings.NewReader("")
}
}