integrate request builder into HTTP client for googleapis support (#157)
Some checks failed
coverage / build (push) Successful in 2m19s
test / test (push) Failing after 17m15s

This commit is contained in:
2025-09-23 15:30:15 +05:00
committed by GitHub
parent b37fca95cf
commit 24801750a7
32 changed files with 9491 additions and 1736 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
}