7
0
gaore-common-sdk-go/sdk/requests/http_request.go

45 lines
908 B
Go
Raw Normal View History

2020-08-04 00:51:19 +08:00
package requests
2020-08-05 12:14:49 +08:00
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils"
"io"
"strings"
)
2020-08-04 00:51:19 +08:00
type HttpRequest struct {
*baseRequest
}
2020-08-04 11:22:37 +08:00
2020-08-04 12:23:34 +08:00
func (request *HttpRequest) init() {
request.baseRequest = defaultBaseRequest()
request.Method = POST
}
2020-08-04 11:22:37 +08:00
func (request *HttpRequest) BuildUrl() string {
return ""
}
func (request *HttpRequest) BuildQueries() string {
return ""
}
2020-08-04 12:23:34 +08:00
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
}
2020-08-05 12:14:49 +08:00
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("")
}
}