integrate request builder into HTTP client for googleapis support (#159)
All checks were successful
coverage / build (push) Successful in 2m19s
test / test (push) Successful in 2m27s

This commit is contained in:
2025-10-03 10:39:44 +05:00
committed by GitHub
parent b2b24e0a9a
commit c757127453
38 changed files with 9820 additions and 1894 deletions

View File

@@ -6,30 +6,10 @@ import (
)
type httpRequest struct {
service string
method string
contentType string
request interface{}
opts client.RequestOptions
}
func newHTTPRequest(service, method string, request interface{}, contentType string, opts ...client.RequestOption) client.Request {
options := client.NewRequestOptions(opts...)
if len(options.ContentType) == 0 {
options.ContentType = contentType
}
return &httpRequest{
service: service,
method: method,
request: request,
contentType: options.ContentType,
opts: options,
}
}
func (h *httpRequest) ContentType() string {
return h.contentType
service string
method string
request any
opts client.RequestOptions
}
func (h *httpRequest) Service() string {
@@ -44,14 +24,18 @@ func (h *httpRequest) Endpoint() string {
return h.method
}
func (h *httpRequest) Codec() codec.Codec {
return nil
func (h *httpRequest) ContentType() string {
return h.opts.ContentType
}
func (h *httpRequest) Body() interface{} {
func (h *httpRequest) Body() any {
return h.request
}
func (h *httpRequest) Codec() codec.Codec {
return nil
}
func (h *httpRequest) Stream() bool {
return h.opts.Stream
}