package http
import "github.com/aws/smithy-go/transport/http"
Package http provides the HTTP transport client and request/response types needed to round trip API operation calls with an service.
Index ¶
- func AddCloseResponseBodyMiddleware(stack *middleware.Stack) error
- func AddComputeContentLengthMiddleware(stack *middleware.Stack) error
- func AddContentChecksumMiddleware(stack *middleware.Stack) error
- func AddErrorCloseResponseBodyMiddleware(stack *middleware.Stack) error
- func AddHeaderValue(header string, value string) func(stack *middleware.Stack) error
- func AddNoPayloadDefaultContentTypeRemover(stack *middleware.Stack) (err error)
- func AddRequireMinimumProtocol(stack *middleware.Stack, major, minor int) error
- func DisableEndpointHostPrefix(ctx context.Context, value bool) context.Context
- func GetDisableDoubleEncoding(p *smithy.Properties) (bool, bool)
- func GetHostnameImmutable(ctx context.Context) (v bool)
- func GetIsContentTypeDefaultValue(ctx context.Context) bool
- func GetIsUnsignedPayload(p *smithy.Properties) (bool, bool)
- func GetSigV4ASigningName(p *smithy.Properties) (string, bool)
- func GetSigV4ASigningRegions(p *smithy.Properties) ([]string, bool)
- func GetSigV4SigningName(p *smithy.Properties) (string, bool)
- func GetSigV4SigningRegion(p *smithy.Properties) (string, bool)
- func IsEndpointHostPrefixDisabled(ctx context.Context) (v bool)
- func JoinPath(a, b string) string
- func JoinRawQuery(a, b string) string
- func NewStackRequest() interface{}
- func ParseTime(text string) (t time.Time, err error)
- func RemoveNoPayloadDefaultContentTypeRemover(stack *middleware.Stack) (err error)
- func RequestCloner(v interface{}) interface{}
- func SetDisableDoubleEncoding(p *smithy.Properties, disableDoubleEncoding bool)
- func SetHeaderValue(header string, value string) func(stack *middleware.Stack) error
- func SetHostnameImmutable(ctx context.Context, value bool) context.Context
- func SetIsContentTypeDefaultValue(ctx context.Context, isDefault bool) context.Context
- func SetIsUnsignedPayload(p *smithy.Properties, isUnsignedPayload bool)
- func SetSigV4ASigningName(p *smithy.Properties, name string)
- func SetSigV4ASigningRegions(p *smithy.Properties, regions []string)
- func SetSigV4SigningName(p *smithy.Properties, name string)
- func SetSigV4SigningRegion(p *smithy.Properties, region string)
- func SplitHTTPDateTimestampHeaderListValues(vs []string) ([]string, error)
- func SplitHeaderListValues(vs []string) ([]string, error)
- func ValidHostLabel(label string) bool
- func ValidPortNumber(port string) bool
- func ValidateContentLengthHeader(stack *middleware.Stack) error
- func ValidateEndpointHost(host string) error
- func WithHeaderComment(header, content string) func(*middleware.Stack) error
- type AfterAttemptInterceptor
- type AfterDeserializationInterceptor
- type AfterExecutionInterceptor
- type AfterSerializationInterceptor
- type AfterSigningInterceptor
- type AfterTransmitInterceptor
- type AuthScheme
- type BeforeAttemptInterceptor
- type BeforeDeserializationInterceptor
- type BeforeExecutionInterceptor
- type BeforeRetryLoopInterceptor
- type BeforeSerializationInterceptor
- type BeforeSigningInterceptor
- type BeforeTransmitInterceptor
- type ClientDo
- type ClientDoFunc
- type ClientHandler
- func NewClientHandler(client ClientDo) ClientHandler
- func NewClientHandlerWithOptions(client ClientDo, opts ...func(*ClientHandler)) ClientHandler
- func (c ClientHandler) Handle(ctx context.Context, input interface{}) ( out interface{}, metadata middleware.Metadata, err error, )
- type ComputeContentLength
- func (m *ComputeContentLength) HandleBuild( ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler, ) ( out middleware.BuildOutput, metadata middleware.Metadata, err error, )
- func (m *ComputeContentLength) ID() string
- type InterceptAfterDeserialization
- func (m *InterceptAfterDeserialization) HandleDeserialize( ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler, ) ( out middleware.DeserializeOutput, md middleware.Metadata, err error, )
- func (m *InterceptAfterDeserialization) ID() string
- type InterceptAfterSerialization
- func (m *InterceptAfterSerialization) HandleSerialize( ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler, ) ( out middleware.SerializeOutput, md middleware.Metadata, err error, )
- func (m *InterceptAfterSerialization) ID() string
- type InterceptAfterSigning
- func (m *InterceptAfterSigning) HandleFinalize( ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, ) ( out middleware.FinalizeOutput, md middleware.Metadata, err error, )
- func (m *InterceptAfterSigning) ID() string
- type InterceptAttempt
- func (m *InterceptAttempt) HandleFinalize( ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, ) ( out middleware.FinalizeOutput, md middleware.Metadata, err error, )
- func (m *InterceptAttempt) ID() string
- type InterceptBeforeDeserialization
- func (m *InterceptBeforeDeserialization) HandleDeserialize( ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler, ) ( out middleware.DeserializeOutput, md middleware.Metadata, err error, )
- func (m *InterceptBeforeDeserialization) ID() string
- type InterceptBeforeRetryLoop
- func (m *InterceptBeforeRetryLoop) HandleFinalize( ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, ) ( out middleware.FinalizeOutput, md middleware.Metadata, err error, )
- func (m *InterceptBeforeRetryLoop) ID() string
- type InterceptBeforeSerialization
- func (m *InterceptBeforeSerialization) HandleSerialize( ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler, ) ( out middleware.SerializeOutput, md middleware.Metadata, err error, )
- func (m *InterceptBeforeSerialization) ID() string
- type InterceptBeforeSigning
- func (m *InterceptBeforeSigning) HandleFinalize( ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, ) ( out middleware.FinalizeOutput, md middleware.Metadata, err error, )
- func (m *InterceptBeforeSigning) ID() string
- type InterceptExecution
- func (m *InterceptExecution) HandleInitialize( ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler, ) ( out middleware.InitializeOutput, md middleware.Metadata, err error, )
- func (m *InterceptExecution) ID() string
- type InterceptTransmit
- func (m *InterceptTransmit) HandleDeserialize( ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler, ) ( out middleware.DeserializeOutput, md middleware.Metadata, err error, )
- func (m *InterceptTransmit) ID() string
- type InterceptorContext
- type InterceptorRegistry
- func (i *InterceptorRegistry) AddAfterAttempt(v AfterAttemptInterceptor)
- func (i *InterceptorRegistry) AddAfterDeserialization(v AfterDeserializationInterceptor)
- func (i *InterceptorRegistry) AddAfterExecution(v AfterExecutionInterceptor)
- func (i *InterceptorRegistry) AddAfterSerialization(v AfterSerializationInterceptor)
- func (i *InterceptorRegistry) AddAfterSigning(v AfterSigningInterceptor)
- func (i *InterceptorRegistry) AddAfterTransmit(v AfterTransmitInterceptor)
- func (i *InterceptorRegistry) AddBeforeAttempt(v BeforeAttemptInterceptor)
- func (i *InterceptorRegistry) AddBeforeDeserialization(v BeforeDeserializationInterceptor)
- func (i *InterceptorRegistry) AddBeforeExecution(v BeforeExecutionInterceptor)
- func (i *InterceptorRegistry) AddBeforeRetryLoop(v BeforeRetryLoopInterceptor)
- func (i *InterceptorRegistry) AddBeforeSerialization(v BeforeSerializationInterceptor)
- func (i *InterceptorRegistry) AddBeforeSigning(v BeforeSigningInterceptor)
- func (i *InterceptorRegistry) AddBeforeTransmit(v BeforeTransmitInterceptor)
- func (i *InterceptorRegistry) Copy() InterceptorRegistry
- type MinimumProtocolError
- type NopClient
- type Request
- func (r *Request) Build(ctx context.Context) *http.Request
- func (r *Request) Clone() *Request
- func (r *Request) GetStream() io.Reader
- func (r *Request) IsHTTPS() bool
- func (r *Request) IsStreamSeekable() bool
- func (r *Request) RewindStream() error
- func (r *Request) SetStream(reader io.Reader) (rc *Request, err error)
- func (r *Request) StreamLength() (size int64, ok bool, err error)
- type RequestResponseLogger
- func (r *RequestResponseLogger) HandleDeserialize( ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler, ) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, )
- func (r *RequestResponseLogger) ID() string
- type RequestSendError
- func (e *RequestSendError) ConnectionError() bool
- func (e *RequestSendError) Error() string
- func (e *RequestSendError) Unwrap() error
- type RequireMinimumProtocol
- func (r *RequireMinimumProtocol) HandleDeserialize( ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler, ) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, )
- func (r *RequireMinimumProtocol) ID() string
- type Response
- type ResponseError
- func (e *ResponseError) Error() string
- func (e *ResponseError) HTTPResponse() *Response
- func (e *ResponseError) HTTPStatusCode() int
- func (e *ResponseError) Unwrap() error
- type Signer
- type UserAgentBuilder
Examples ¶
Functions ¶
func AddCloseResponseBodyMiddleware ¶
func AddCloseResponseBodyMiddleware(stack *middleware.Stack) error
AddCloseResponseBodyMiddleware adds the middleware to automatically close the response body of an operation request, after the response had been deserialized.
func AddComputeContentLengthMiddleware ¶
func AddComputeContentLengthMiddleware(stack *middleware.Stack) error
AddComputeContentLengthMiddleware adds ComputeContentLength to the middleware stack's Build step.
func AddContentChecksumMiddleware ¶
func AddContentChecksumMiddleware(stack *middleware.Stack) error
AddContentChecksumMiddleware adds checksum middleware to middleware's build step.
func AddErrorCloseResponseBodyMiddleware ¶
func AddErrorCloseResponseBodyMiddleware(stack *middleware.Stack) error
AddErrorCloseResponseBodyMiddleware adds the middleware to automatically close the response body of an operation request if the request response failed.
func AddHeaderValue ¶
func AddHeaderValue(header string, value string) func(stack *middleware.Stack) error
AddHeaderValue returns a stack mutator that adds the header value pair to header. Appends to any existing values if present.
func AddNoPayloadDefaultContentTypeRemover ¶
func AddNoPayloadDefaultContentTypeRemover(stack *middleware.Stack) (err error)
AddNoPayloadDefaultContentTypeRemover Adds the DefaultContentTypeRemover middleware to the stack after the operation serializer. This middleware will remove the content-type header from the request if it was set as a default value, and no request payload is present.
Returns error if unable to add the middleware.
func AddRequireMinimumProtocol ¶
func AddRequireMinimumProtocol(stack *middleware.Stack, major, minor int) error
AddRequireMinimumProtocol adds the RequireMinimumProtocol middleware to the stack using the provided minimum protocol major and minor version.
func DisableEndpointHostPrefix ¶
DisableEndpointHostPrefix sets or modifies whether the request's endpoint host prefixing should be disabled. If value is true, endpoint host prefixing will be disabled.
Scoped to stack values. Use middleware#ClearStackValues to clear all stack values.
func GetDisableDoubleEncoding ¶
func GetDisableDoubleEncoding(p *smithy.Properties) (bool, bool)
GetDisableDoubleEncoding gets whether the payload is unsigned from Properties.
func GetHostnameImmutable ¶
GetHostnameImmutable retrieves whether the endpoint hostname should be considered immutable or not.
Scoped to stack values. Use middleware#ClearStackValues to clear all stack values.
func GetIsContentTypeDefaultValue ¶
GetIsContentTypeDefaultValue returns if the content-type HTTP header on the request is a default value that was auto assigned by an operation serializer. Allows middleware post serialization to know if the content-type was auto set to a default value or not.
Also returns false if the Context value was never updated to include if content-type was set to a default value.
func GetIsUnsignedPayload ¶
func GetIsUnsignedPayload(p *smithy.Properties) (bool, bool)
GetIsUnsignedPayload gets whether the payload is unsigned from Properties.
func GetSigV4ASigningName ¶
func GetSigV4ASigningName(p *smithy.Properties) (string, bool)
GetSigV4ASigningName gets the v4a signing name from Properties.
func GetSigV4ASigningRegions ¶
func GetSigV4ASigningRegions(p *smithy.Properties) ([]string, bool)
GetSigV4ASigningRegion gets the v4a signing region set from Properties.
func GetSigV4SigningName ¶
func GetSigV4SigningName(p *smithy.Properties) (string, bool)
GetSigV4SigningName gets the signing name from Properties.
func GetSigV4SigningRegion ¶
func GetSigV4SigningRegion(p *smithy.Properties) (string, bool)
GetSigV4SigningRegion gets the signing region from Properties.
func IsEndpointHostPrefixDisabled ¶
IsEndpointHostPrefixDisabled retrieves whether the hostname prefixing is disabled.
Scoped to stack values. Use middleware#ClearStackValues to clear all stack values.
func JoinPath ¶
JoinPath returns an absolute URL path composed of the two paths provided. Enforces that the returned path begins with '/'. If added path is empty the returned path suffix will match the first parameter suffix.
func JoinRawQuery ¶
JoinRawQuery returns an absolute raw query expression. Any duplicate '&' will be collapsed to single separator between values.
func NewStackRequest ¶
func NewStackRequest() interface{}
NewStackRequest returns an initialized request ready to be populated with the HTTP request details. Returns empty interface so the function can be used as a parameter to the Smithy middleware Stack constructor.
func ParseTime ¶
ParseTime parses a time string like the HTTP Date header. This uses a more relaxed rule set for date parsing compared to the standard library.
func RemoveNoPayloadDefaultContentTypeRemover ¶
func RemoveNoPayloadDefaultContentTypeRemover(stack *middleware.Stack) (err error)
RemoveNoPayloadDefaultContentTypeRemover removes the DefaultContentTypeRemover middleware from the stack. Returns an error if unable to remove the middleware.
func RequestCloner ¶
func RequestCloner(v interface{}) interface{}
RequestCloner is a function that can take an input request type and clone the request for use in a subsequent retry attempt.
func SetDisableDoubleEncoding ¶
func SetDisableDoubleEncoding(p *smithy.Properties, disableDoubleEncoding bool)
SetDisableDoubleEncoding sets whether the payload is unsigned on Properties.
func SetHeaderValue ¶
func SetHeaderValue(header string, value string) func(stack *middleware.Stack) error
SetHeaderValue returns a stack mutator that adds the header value pair to header. Replaces any existing values if present.
func SetHostnameImmutable ¶
SetHostnameImmutable sets or modifies whether the request's endpoint hostname should be considered immutable or not.
Scoped to stack values. Use middleware#ClearStackValues to clear all stack values.
func SetIsContentTypeDefaultValue ¶
SetIsContentTypeDefaultValue returns a Context specifying if the request's content-type header was set to a default value.
func SetIsUnsignedPayload ¶
func SetIsUnsignedPayload(p *smithy.Properties, isUnsignedPayload bool)
SetIsUnsignedPayload sets whether the payload is unsigned on Properties.
func SetSigV4ASigningName ¶
func SetSigV4ASigningName(p *smithy.Properties, name string)
SetSigV4ASigningName sets the signing name on Properties.
func SetSigV4ASigningRegions ¶
func SetSigV4ASigningRegions(p *smithy.Properties, regions []string)
SetSigV4ASigningRegions sets the v4a signing region set on Properties.
func SetSigV4SigningName ¶
func SetSigV4SigningName(p *smithy.Properties, name string)
SetSigV4SigningName sets the signing name on Properties.
func SetSigV4SigningRegion ¶
func SetSigV4SigningRegion(p *smithy.Properties, region string)
SetSigV4SigningRegion sets the signing region on Properties.
func SplitHTTPDateTimestampHeaderListValues ¶
SplitHTTPDateTimestampHeaderListValues attempts to split the HTTP-Date timestamp values in the slice by commas, and return a list of all values separated. The split is aware of the HTTP-Date timestamp format, and will skip comma within the timestamp value. Returns an error if unable to split the timestamp values.
func SplitHeaderListValues ¶
SplitHeaderListValues attempts to split the elements of the slice by commas, and return a list of all values separated. Returns error if unable to separate the values.
func ValidHostLabel ¶
ValidHostLabel returns whether the label is a valid RFC 3986 host label.
func ValidPortNumber ¶
ValidPortNumber returns whether the port is valid RFC 3986 port.
func ValidateContentLengthHeader ¶
func ValidateContentLengthHeader(stack *middleware.Stack) error
ValidateContentLengthHeader adds middleware that validates request content-length is set to value greater than zero.
func ValidateEndpointHost ¶
ValidateEndpointHost validates that the host string passed in is a valid RFC 3986 host. Returns error if the host is not valid.
func WithHeaderComment ¶
func WithHeaderComment(header, content string) func(*middleware.Stack) error
WithHeaderComment instruments a middleware stack to append an HTTP field comment to the given header as specified in RFC 9110 (https://www.rfc-editor.org/rfc/rfc9110#name-comments).
The header is case-insensitive. If the provided header exists when the middleware runs, the content will be inserted as-is enclosed in parentheses.
Note that per the HTTP specification, comments are only allowed in fields containing "comment" as part of their field value definition, but this API will NOT verify whether the provided header is one of them.
WithHeaderComment MAY be applied more than once to a middleware stack and/or more than once per header.
Types ¶
type AfterAttemptInterceptor ¶
type AfterAttemptInterceptor interface {
AfterAttempt(ctx context.Context, in *InterceptorContext) error
}
AfterAttemptInterceptor runs right after the incoming HTTP response is deserialized. This hook is invoked regardless of whether the deserialized result was an error, or if another interceptor within the retry loop returned an error.
Available InterceptorContext fields:
- Input
- Output (IF the operation had a success-level response)
- Request (IF the operation did not return an error during serialization)
- Response (IF the operation was able to transmit the HTTP request)
type AfterDeserializationInterceptor ¶
type AfterDeserializationInterceptor interface {
AfterDeserialization(ctx context.Context, in *InterceptorContext) error
}
AfterDeserializationInterceptor runs right after the incoming HTTP response is deserialized. This hook is invoked regardless of whether the deserialized result was an error.
This interceptor IS NOT invoked if the HTTP round-trip was not successful.
Available InterceptorContext fields:
- Input
- Output (IF the operation had a success-level response)
- Request
- Response
type AfterExecutionInterceptor ¶
type AfterExecutionInterceptor interface {
AfterExecution(ctx context.Context, in *InterceptorContext) error
}
AfterExecutionInterceptor runs after everything else. It runs regardless of how far the operation progressed in its lifecycle, and regardless of whether the operation succeeded or failed.
Available InterceptorContext fields:
- Input
- Output (IF the operation had a success-level response)
- Request (IF the operation did not return an error during serialization)
- Response (IF the operation was able to transmit the HTTP request)
type AfterSerializationInterceptor ¶
type AfterSerializationInterceptor interface {
AfterSerialization(ctx context.Context, in *InterceptorContext) error
}
AfterSerializationInterceptor runs after the operation input is serialized into its transport request.
Available InterceptorContext fields:
- Input
- Request
type AfterSigningInterceptor ¶
type AfterSigningInterceptor interface {
AfterSigning(ctx context.Context, in *InterceptorContext) error
}
AfterSigningInterceptor runs right after the request is signed.
It is unsafe to modify the outgoing HTTP request at or past this hook, since doing so may invalidate the signature of the request.
Available InterceptorContext fields:
- Input
- Request
type AfterTransmitInterceptor ¶
type AfterTransmitInterceptor interface {
AfterTransmit(ctx context.Context, in *InterceptorContext) error
}
AfterTransmitInterceptor runs right after the HTTP response is received.
It will always be invoked when a response is received, regardless of its status code. Conversely, it WILL NOT be invoked if the HTTP round-trip was not successful, e.g. because of a DNS resolution error
Available InterceptorContext fields:
- Input
- Request
- Response
type AuthScheme ¶
type AuthScheme interface {
SchemeID() string
IdentityResolver(auth.IdentityResolverOptions) auth.IdentityResolver
Signer() Signer
}
AuthScheme defines an HTTP authentication scheme.
func NewAnonymousScheme ¶
func NewAnonymousScheme() AuthScheme
NewAnonymousScheme returns the anonymous HTTP auth scheme.
type BeforeAttemptInterceptor ¶
type BeforeAttemptInterceptor interface {
BeforeAttempt(ctx context.Context, in *InterceptorContext) error
}
BeforeAttemptInterceptor runs right before every attempt in the retry loop.
If this interceptor returns an error, AfterAttempt interceptors WILL NOT be invoked.
Available InterceptorContext fields:
- Input
- Request
type BeforeDeserializationInterceptor ¶
type BeforeDeserializationInterceptor interface {
BeforeDeserialization(ctx context.Context, in *InterceptorContext) error
}
BeforeDeserializationInterceptor runs right before the incoming HTTP response is deserialized.
This interceptor IS NOT invoked if the HTTP round-trip was not successful.
Deserialization occurs within the operation's retry loop.
Available InterceptorContext fields:
- Input
- Request
- Response
type BeforeExecutionInterceptor ¶
type BeforeExecutionInterceptor interface {
BeforeExecution(ctx context.Context, in *InterceptorContext) error
}
BeforeExecutionInterceptor runs before anything else in the operation lifecycle.
Available InterceptorContext fields:
- Input
type BeforeRetryLoopInterceptor ¶
type BeforeRetryLoopInterceptor interface {
BeforeRetryLoop(ctx context.Context, in *InterceptorContext) error
}
BeforeRetryLoopInterceptor runs right before the operation enters the retry loop.
Available InterceptorContext fields:
- Input
- Request
type BeforeSerializationInterceptor ¶
type BeforeSerializationInterceptor interface {
BeforeSerialization(ctx context.Context, in *InterceptorContext) error
}
BeforeSerializationInterceptor runs before the operation input is serialized into its transport request.
Serialization occurs before the operation's retry loop.
Available InterceptorContext fields:
- Input
type BeforeSigningInterceptor ¶
type BeforeSigningInterceptor interface {
BeforeSigning(ctx context.Context, in *InterceptorContext) error
}
BeforeSigningInterceptor runs right before the request is signed.
Signing occurs within the operation's retry loop.
Available InterceptorContext fields:
- Input
- Request
type BeforeTransmitInterceptor ¶
type BeforeTransmitInterceptor interface {
BeforeTransmit(ctx context.Context, in *InterceptorContext) error
}
BeforeTransmitInterceptor runs right before the HTTP request is sent.
HTTP transmit occurs within the operation's retry loop.
Available InterceptorContext fields:
- Input
- Request
type ClientDo ¶
ClientDo provides the interface for custom HTTP client implementations.
type ClientDoFunc ¶
ClientDoFunc provides a helper to wrap a function as an HTTP client for round tripping requests.
func (ClientDoFunc) Do ¶
Do will invoke the underlying func, returning the result.
type ClientHandler ¶
type ClientHandler struct {
Meter metrics.Meter // For HTTP client metrics.
// contains filtered or unexported fields
}
ClientHandler wraps a client that implements the HTTP Do method. Standard implementation is http.Client.
func NewClientHandler ¶
func NewClientHandler(client ClientDo) ClientHandler
NewClientHandler returns an initialized middleware handler for the client.
Deprecated: Use NewClientHandlerWithOptions.
func NewClientHandlerWithOptions ¶
func NewClientHandlerWithOptions(client ClientDo, opts ...func(*ClientHandler)) ClientHandler
NewClientHandlerWithOptions returns an initialized middleware handler for the client with applied options.
func (ClientHandler) Handle ¶
func (c ClientHandler) Handle(ctx context.Context, input interface{}) ( out interface{}, metadata middleware.Metadata, err error, )
Handle implements the middleware Handler interface, that will invoke the underlying HTTP client. Requires the input to be a Smithy *Request. Returns a smithy *Response, or error if the request failed.
type ComputeContentLength ¶
type ComputeContentLength struct {
}
ComputeContentLength provides a middleware to set the content-length header for the length of a serialize request body.
func (*ComputeContentLength) HandleBuild ¶
func (m *ComputeContentLength) HandleBuild( ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler, ) ( out middleware.BuildOutput, metadata middleware.Metadata, err error, )
HandleBuild adds the length of the serialized request to the HTTP header if the length can be determined.
func (*ComputeContentLength) ID ¶
func (m *ComputeContentLength) ID() string
ID returns the identifier for the ComputeContentLength.
type InterceptAfterDeserialization ¶
type InterceptAfterDeserialization struct {
Interceptors []AfterDeserializationInterceptor
}
InterceptAfterDeserialization runs AfterDeserializationInterceptors.
func (*InterceptAfterDeserialization) HandleDeserialize ¶
func (m *InterceptAfterDeserialization) HandleDeserialize( ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler, ) ( out middleware.DeserializeOutput, md middleware.Metadata, err error, )
HandleDeserialize runs the interceptors.
func (*InterceptAfterDeserialization) ID ¶
func (m *InterceptAfterDeserialization) ID() string
ID identifies the middleware.
type InterceptAfterSerialization ¶
type InterceptAfterSerialization struct {
Interceptors []AfterSerializationInterceptor
}
InterceptAfterSerialization runs AfterSerializationInterceptors.
func (*InterceptAfterSerialization) HandleSerialize ¶
func (m *InterceptAfterSerialization) HandleSerialize( ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler, ) ( out middleware.SerializeOutput, md middleware.Metadata, err error, )
HandleSerialize runs the interceptors.
func (*InterceptAfterSerialization) ID ¶
func (m *InterceptAfterSerialization) ID() string
ID identifies the middleware.
type InterceptAfterSigning ¶
type InterceptAfterSigning struct {
Interceptors []AfterSigningInterceptor
}
InterceptAfterSigning runs AfterSigningInterceptors.
func (*InterceptAfterSigning) HandleFinalize ¶
func (m *InterceptAfterSigning) HandleFinalize( ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, ) ( out middleware.FinalizeOutput, md middleware.Metadata, err error, )
HandleFinalize runs the interceptors.
func (*InterceptAfterSigning) ID ¶
func (m *InterceptAfterSigning) ID() string
ID identifies the middleware.
type InterceptAttempt ¶
type InterceptAttempt struct {
BeforeAttempt []BeforeAttemptInterceptor
AfterAttempt []AfterAttemptInterceptor
}
InterceptAttempt runs AfterAttemptInterceptors.
func (*InterceptAttempt) HandleFinalize ¶
func (m *InterceptAttempt) HandleFinalize( ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, ) ( out middleware.FinalizeOutput, md middleware.Metadata, err error, )
HandleFinalize runs the interceptors.
func (*InterceptAttempt) ID ¶
func (m *InterceptAttempt) ID() string
ID identifies the middleware.
type InterceptBeforeDeserialization ¶
type InterceptBeforeDeserialization struct {
Interceptors []BeforeDeserializationInterceptor
}
InterceptBeforeDeserialization runs BeforeDeserializationInterceptors.
func (*InterceptBeforeDeserialization) HandleDeserialize ¶
func (m *InterceptBeforeDeserialization) HandleDeserialize( ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler, ) ( out middleware.DeserializeOutput, md middleware.Metadata, err error, )
HandleDeserialize runs the interceptors.
func (*InterceptBeforeDeserialization) ID ¶
func (m *InterceptBeforeDeserialization) ID() string
ID identifies the middleware.
type InterceptBeforeRetryLoop ¶
type InterceptBeforeRetryLoop struct {
Interceptors []BeforeRetryLoopInterceptor
}
InterceptBeforeRetryLoop runs BeforeRetryLoopInterceptors.
func (*InterceptBeforeRetryLoop) HandleFinalize ¶
func (m *InterceptBeforeRetryLoop) HandleFinalize( ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, ) ( out middleware.FinalizeOutput, md middleware.Metadata, err error, )
HandleFinalize runs the interceptors.
func (*InterceptBeforeRetryLoop) ID ¶
func (m *InterceptBeforeRetryLoop) ID() string
ID identifies the middleware.
type InterceptBeforeSerialization ¶
type InterceptBeforeSerialization struct {
Interceptors []BeforeSerializationInterceptor
}
InterceptBeforeSerialization runs BeforeSerializationInterceptors.
func (*InterceptBeforeSerialization) HandleSerialize ¶
func (m *InterceptBeforeSerialization) HandleSerialize( ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler, ) ( out middleware.SerializeOutput, md middleware.Metadata, err error, )
HandleSerialize runs the interceptors.
func (*InterceptBeforeSerialization) ID ¶
func (m *InterceptBeforeSerialization) ID() string
ID identifies the middleware.
type InterceptBeforeSigning ¶
type InterceptBeforeSigning struct {
Interceptors []BeforeSigningInterceptor
}
InterceptBeforeSigning runs BeforeSigningInterceptors.
func (*InterceptBeforeSigning) HandleFinalize ¶
func (m *InterceptBeforeSigning) HandleFinalize( ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, ) ( out middleware.FinalizeOutput, md middleware.Metadata, err error, )
HandleFinalize runs the interceptors.
func (*InterceptBeforeSigning) ID ¶
func (m *InterceptBeforeSigning) ID() string
ID identifies the middleware.
type InterceptExecution ¶
type InterceptExecution struct {
BeforeExecution []BeforeExecutionInterceptor
AfterExecution []AfterExecutionInterceptor
}
InterceptExecution runs Before/AfterExecutionInterceptors.
func (*InterceptExecution) HandleInitialize ¶
func (m *InterceptExecution) HandleInitialize( ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler, ) ( out middleware.InitializeOutput, md middleware.Metadata, err error, )
HandleInitialize runs the interceptors.
func (*InterceptExecution) ID ¶
func (m *InterceptExecution) ID() string
ID identifies the middleware.
type InterceptTransmit ¶
type InterceptTransmit struct {
BeforeTransmit []BeforeTransmitInterceptor
AfterTransmit []AfterTransmitInterceptor
}
InterceptTransmit runs BeforeTransmitInterceptors and AfterTransmitInterceptors.
func (*InterceptTransmit) HandleDeserialize ¶
func (m *InterceptTransmit) HandleDeserialize( ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler, ) ( out middleware.DeserializeOutput, md middleware.Metadata, err error, )
HandleDeserialize runs the interceptors.
func (*InterceptTransmit) ID ¶
func (m *InterceptTransmit) ID() string
ID identifies the middleware.
type InterceptorContext ¶
InterceptorContext is all the information available in different interceptors.
Not all information is available in each interceptor, see each interface definition for more details.
type InterceptorRegistry ¶
type InterceptorRegistry struct {
BeforeExecution []BeforeExecutionInterceptor
BeforeSerialization []BeforeSerializationInterceptor
AfterSerialization []AfterSerializationInterceptor
BeforeRetryLoop []BeforeRetryLoopInterceptor
BeforeAttempt []BeforeAttemptInterceptor
BeforeSigning []BeforeSigningInterceptor
AfterSigning []AfterSigningInterceptor
BeforeTransmit []BeforeTransmitInterceptor
AfterTransmit []AfterTransmitInterceptor
BeforeDeserialization []BeforeDeserializationInterceptor
AfterDeserialization []AfterDeserializationInterceptor
AfterAttempt []AfterAttemptInterceptor
AfterExecution []AfterExecutionInterceptor
}
InterceptorRegistry holds a list of operation interceptors.
Interceptors allow callers to insert custom behavior at well-defined points within a client's operation lifecycle.
Interceptor context
All interceptors are invoked with a context object that contains input and output containers for the operation. The individual fields that are available will depend on what the interceptor is and, in certain interceptors, how far the operation was able to progress. See the documentation for each interface definition for more information about field availability.
Implementations MUST NOT directly mutate the values of the fields in the interceptor context. They are free to mutate the existing values _pointed to_ by those fields, however.
Returning errors
All interceptors can return errors. If an interceptor returns an error _before_ the client's retry loop, the operation will fail immediately. If one returns an error _within_ the retry loop, the error WILL be considered according to the client's retry policy.
Adding interceptors
Idiomatically you will simply use one of the Add() receiver methods to register interceptors as desired. However, the list for each interface is exported on the registry struct and the caller is free to manipulate it directly, for example, to register a number of interceptors all at once, or to remove one that was previously registered.
The base SDK client WILL NOT add any interceptors. SDK operations and customizations are implemented in terms of middleware.
Modifications to the registry will not persist across operation calls when using per-operation functional options. This means you can register interceptors on a per-operation basis without affecting other operations.
func (*InterceptorRegistry) AddAfterAttempt ¶
func (i *InterceptorRegistry) AddAfterAttempt(v AfterAttemptInterceptor)
AddAfterAttempt registers the provided AfterAttemptInterceptor.
func (*InterceptorRegistry) AddAfterDeserialization ¶
func (i *InterceptorRegistry) AddAfterDeserialization(v AfterDeserializationInterceptor)
AddAfterDeserialization registers the provided AfterDeserializationInterceptor.
func (*InterceptorRegistry) AddAfterExecution ¶
func (i *InterceptorRegistry) AddAfterExecution(v AfterExecutionInterceptor)
AddAfterExecution registers the provided AfterExecutionInterceptor.
func (*InterceptorRegistry) AddAfterSerialization ¶
func (i *InterceptorRegistry) AddAfterSerialization(v AfterSerializationInterceptor)
AddAfterSerialization registers the provided AfterSerializationInterceptor.
func (*InterceptorRegistry) AddAfterSigning ¶
func (i *InterceptorRegistry) AddAfterSigning(v AfterSigningInterceptor)
AddAfterSigning registers the provided AfterSigningInterceptor.
func (*InterceptorRegistry) AddAfterTransmit ¶
func (i *InterceptorRegistry) AddAfterTransmit(v AfterTransmitInterceptor)
AddAfterTransmit registers the provided AfterTransmitInterceptor.
func (*InterceptorRegistry) AddBeforeAttempt ¶
func (i *InterceptorRegistry) AddBeforeAttempt(v BeforeAttemptInterceptor)
AddBeforeAttempt registers the provided BeforeAttemptInterceptor.
func (*InterceptorRegistry) AddBeforeDeserialization ¶
func (i *InterceptorRegistry) AddBeforeDeserialization(v BeforeDeserializationInterceptor)
AddBeforeDeserialization registers the provided BeforeDeserializationInterceptor.
func (*InterceptorRegistry) AddBeforeExecution ¶
func (i *InterceptorRegistry) AddBeforeExecution(v BeforeExecutionInterceptor)
AddBeforeExecution registers the provided BeforeExecutionInterceptor.
func (*InterceptorRegistry) AddBeforeRetryLoop ¶
func (i *InterceptorRegistry) AddBeforeRetryLoop(v BeforeRetryLoopInterceptor)
AddBeforeRetryLoop registers the provided BeforeRetryLoopInterceptor.
func (*InterceptorRegistry) AddBeforeSerialization ¶
func (i *InterceptorRegistry) AddBeforeSerialization(v BeforeSerializationInterceptor)
AddBeforeSerialization registers the provided BeforeSerializationInterceptor.
func (*InterceptorRegistry) AddBeforeSigning ¶
func (i *InterceptorRegistry) AddBeforeSigning(v BeforeSigningInterceptor)
AddBeforeSigning registers the provided BeforeSigningInterceptor.
func (*InterceptorRegistry) AddBeforeTransmit ¶
func (i *InterceptorRegistry) AddBeforeTransmit(v BeforeTransmitInterceptor)
AddBeforeTransmit registers the provided BeforeTransmitInterceptor.
func (*InterceptorRegistry) Copy ¶
func (i *InterceptorRegistry) Copy() InterceptorRegistry
Copy returns a deep copy of the registry. This is used by SDK clients on each operation call in order to prevent per-op config mutation from persisting.
type MinimumProtocolError ¶
type MinimumProtocolError struct {
// contains filtered or unexported fields
}
MinimumProtocolError is an error type indicating that the established connection did not meet the expected minimum HTTP protocol version.
func (*MinimumProtocolError) Error ¶
func (m *MinimumProtocolError) Error() string
Error returns the error message.
type NopClient ¶
type NopClient struct{}
NopClient provides a client that ignores the request, and returns an empty successful HTTP response value.
func (NopClient) Do ¶
Do ignores the request and returns a 200 status empty response.
type Request ¶
Request provides the HTTP specific request structure for HTTP specific
middleware steps to use to serialize input, and send an operation's request.
Code:
Output:Example (SerializeMiddleware)¶
{
// Create the stack and provide the function that will create a new Request
// when the SerializeStep is invoked.
stack := middleware.NewStack("serialize example", NewStackRequest)
type Input struct {
FooName string
BarCount int
}
// Add the serialization middleware.
stack.Serialize.Add(middleware.SerializeMiddlewareFunc("example serialize",
func(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
middleware.SerializeOutput, middleware.Metadata, error,
) {
req := in.Request.(*Request)
input := in.Parameters.(*Input)
req.Header.Set("foo-name", input.FooName)
req.Header.Set("bar-count", strconv.Itoa(input.BarCount))
return next.HandleSerialize(ctx, in)
}),
middleware.After,
)
// Mock example handler taking the request input and returning a response
mockHandler := middleware.HandlerFunc(func(ctx context.Context, in interface{}) (
output interface{}, metadata middleware.Metadata, err error,
) {
// Returns the standard http Request for the handler to make request
// using standard http compatible client.
req := in.(*Request).Build(context.Background())
fmt.Println("foo-name", req.Header.Get("foo-name"))
fmt.Println("bar-count", req.Header.Get("bar-count"))
return &Response{
Response: &http.Response{
StatusCode: 200,
Header: http.Header{},
},
}, metadata, nil
})
// Use the stack to decorate the handler then invoke the decorated handler
// with the inputs.
handler := middleware.DecorateHandler(mockHandler, stack)
_, _, err := handler.Handle(context.Background(), &Input{FooName: "abc", BarCount: 123})
if err != nil {
fmt.Fprintf(os.Stderr, "failed to call operation, %v", err)
return
}
// Output:
// foo-name abc
// bar-count 123
}
foo-name abc
bar-count 123
func (*Request) Build ¶
Build returns a build standard HTTP request value from the Smithy request. The request's stream is wrapped in a safe container that allows it to be reused for subsequent attempts.
func (*Request) Clone ¶
Clone returns a deep copy of the Request for the new context. A reference to the Stream is copied, but the underlying stream is not copied.
func (*Request) GetStream ¶
GetStream returns the request stream io.Reader if a stream is set. If no stream is present nil will be returned.
func (*Request) IsHTTPS ¶
IsHTTPS returns if the request is HTTPS. Returns false if no endpoint URL is set.
func (*Request) IsStreamSeekable ¶
IsStreamSeekable returns whether the stream is seekable.
func (*Request) RewindStream ¶
RewindStream will rewind the io.Reader to the relative start position if it is an io.Seeker.
func (*Request) SetStream ¶
SetStream returns a clone of the request with the stream set to the provided reader. May return an error if the provided reader is seekable but returns an error.
func (*Request) StreamLength ¶
StreamLength returns the number of bytes of the serialized stream attached to the request and ok set. If the length cannot be determined, an error will be returned.
type RequestResponseLogger ¶
type RequestResponseLogger struct {
LogRequest bool
LogRequestWithBody bool
LogResponse bool
LogResponseWithBody bool
}
RequestResponseLogger is a deserialize middleware that will log the request and response HTTP messages and optionally their respective bodies. Will not perform any logging if none of the options are set.
func (*RequestResponseLogger) HandleDeserialize ¶
func (r *RequestResponseLogger) HandleDeserialize( ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler, ) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, )
HandleDeserialize will log the request and response HTTP messages if configured accordingly.
func (*RequestResponseLogger) ID ¶
func (r *RequestResponseLogger) ID() string
ID is the middleware identifier.
type RequestSendError ¶
type RequestSendError struct {
Err error
}
RequestSendError provides a generic request transport error. This error should wrap errors making HTTP client requests.
The ClientHandler will wrap the HTTP client's error if the client request fails, and did not fail because of context canceled.
func (*RequestSendError) ConnectionError ¶
func (e *RequestSendError) ConnectionError() bool
ConnectionError returns that the error is related to not being able to send the request, or receive a response from the service.
func (*RequestSendError) Error ¶
func (e *RequestSendError) Error() string
func (*RequestSendError) Unwrap ¶
func (e *RequestSendError) Unwrap() error
Unwrap returns the underlying error, if there was one.
type RequireMinimumProtocol ¶
RequireMinimumProtocol is a deserialization middleware that asserts that the established HTTP connection meets the minimum major ad minor version.
func (*RequireMinimumProtocol) HandleDeserialize ¶
func (r *RequireMinimumProtocol) HandleDeserialize( ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler, ) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, )
HandleDeserialize asserts that the established connection is a HTTP connection with the minimum major and minor protocol version.
func (*RequireMinimumProtocol) ID ¶
func (r *RequireMinimumProtocol) ID() string
ID returns the middleware identifier string.
type Response ¶
Response provides the HTTP specific response structure for HTTP specific
middleware steps to use to deserialize the response from an operation call.
Code:
Output:Example (DeserializeMiddleware)¶
{
// Create the stack and provide the function that will create a new Request
// when the SerializeStep is invoked.
stack := middleware.NewStack("deserialize example", NewStackRequest)
type Output struct {
FooName string
BarCount int
}
// Add a Deserialize middleware that will extract the RawResponse and
// deserialize into the target output type.
stack.Deserialize.Add(middleware.DeserializeMiddlewareFunc("example deserialize",
func(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return middleware.DeserializeOutput{}, metadata, err
}
metadata.Set("example-meta", "meta-value")
rawResp := out.RawResponse.(*Response)
out.Result = &Output{
FooName: rawResp.Header.Get("foo-name"),
BarCount: func() int {
v, _ := strconv.Atoi(rawResp.Header.Get("bar-count"))
return v
}(),
}
return out, metadata, nil
}),
middleware.After,
)
// Mock example handler taking the request input and returning a response
mockHandler := middleware.HandlerFunc(func(ctx context.Context, in interface{}) (
output interface{}, metadata middleware.Metadata, err error,
) {
resp := &http.Response{
StatusCode: 200,
Header: http.Header{},
}
resp.Header.Set("foo-name", "abc")
resp.Header.Set("bar-count", "123")
// The handler's returned response will be available as the
// DeserializeOutput.RawResponse field.
return &Response{
Response: resp,
}, metadata, nil
})
// Use the stack to decorate the handler then invoke the decorated handler
// with the inputs.
handler := middleware.DecorateHandler(mockHandler, stack)
result, metadata, err := handler.Handle(context.Background(), struct{}{})
if err != nil {
fmt.Fprintf(os.Stderr, "failed to call operation, %v", err)
return
}
// Cast the result returned by the handler to the expected Output type.
res := result.(*Output)
fmt.Println("FooName", res.FooName)
fmt.Println("BarCount", res.BarCount)
fmt.Println("Metadata:", "example-meta:", metadata.Get("example-meta"))
// Output:
// FooName abc
// BarCount 123
// Metadata: example-meta: meta-value
}
FooName abc
BarCount 123
Metadata: example-meta: meta-value
type ResponseError ¶
ResponseError provides the HTTP centric error type wrapping the underlying
error with the HTTP response value.
Code:
Output:Example¶
{
stack := middleware.NewStack("my cool stack", NewStackRequest)
stack.Deserialize.Add(middleware.DeserializeMiddlewareFunc("wrap http response error",
func(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err == nil {
// Nothing to do when there is no error.
return out, metadata, err
}
rawResp, ok := out.RawResponse.(*Response)
if !ok {
// No raw response to wrap with.
return out, metadata, err
}
// Wrap the returned error with the response error containing the
// returned response.
err = &ResponseError{
Response: rawResp,
Err: err,
}
return out, metadata, err
}),
middleware.After,
)
stack.Deserialize.Add(middleware.DeserializeMiddlewareFunc("deserialize error",
func(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return middleware.DeserializeOutput{}, metadata, err
}
rawResp := out.RawResponse.(*Response)
if rawResp.StatusCode == 200 {
return out, metadata, nil
}
// Deserialize the response API error values.
err = &smithy.GenericAPIError{
Code: rawResp.Header.Get("Error-Code"),
Message: rawResp.Header.Get("Error-Message"),
}
return out, metadata, err
}),
middleware.After,
)
// Mock example handler taking the request input and returning a response
mockHandler := middleware.HandlerFunc(func(ctx context.Context, in interface{}) (
output interface{}, metadata middleware.Metadata, err error,
) {
// populate the mock response with an API error and additional data.
resp := &http.Response{
StatusCode: 404,
Header: http.Header{
"Extra-Header": []string{"foo value"},
"Error-Code": []string{"FooException"},
"Error-Message": []string{"some message about the error"},
},
}
// The handler's returned response will be available as the
// DeserializeOutput.RawResponse field.
return &Response{
Response: resp,
}, metadata, nil
})
// Use the stack to decorate the handler then invoke the decorated handler
// with the inputs.
handler := middleware.DecorateHandler(mockHandler, stack)
_, _, err := handler.Handle(context.Background(), struct{}{})
if err == nil {
fmt.Printf("expect error, got none")
return
}
if err != nil {
var apiErr smithy.APIError
if errors.As(err, &apiErr) {
fmt.Printf("request failed: %s, %s\n", apiErr.ErrorCode(), apiErr.ErrorMessage())
}
var respErr *ResponseError
if errors.As(err, &respErr) {
fmt.Printf("response status: %v\n", respErr.HTTPStatusCode())
fmt.Printf("response header: %v\n", respErr.HTTPResponse().Header.Get("Extra-Header"))
}
}
// Output:
// request failed: FooException, some message about the error
// response status: 404
// response header: foo value
}
request failed: FooException, some message about the error
response status: 404
response header: foo value
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
func (*ResponseError) HTTPResponse ¶
func (e *ResponseError) HTTPResponse() *Response
HTTPResponse returns the HTTP response received from the service.
func (*ResponseError) HTTPStatusCode ¶
func (e *ResponseError) HTTPStatusCode() int
HTTPStatusCode returns the HTTP response status code received from the service.
func (*ResponseError) Unwrap ¶
func (e *ResponseError) Unwrap() error
Unwrap returns the nested error if any, or nil.
type Signer ¶
type Signer interface {
SignRequest(context.Context, *Request, auth.Identity, smithy.Properties) error
}
Signer defines the interface through which HTTP requests are supplemented with an Identity.
type UserAgentBuilder ¶
type UserAgentBuilder struct {
// contains filtered or unexported fields
}
UserAgentBuilder is a builder for a HTTP User-Agent string.
func NewUserAgentBuilder ¶
func NewUserAgentBuilder() *UserAgentBuilder
NewUserAgentBuilder returns a new UserAgentBuilder.
func (*UserAgentBuilder) AddKey ¶
func (u *UserAgentBuilder) AddKey(key string)
AddKey adds the named component/product to the agent string
func (*UserAgentBuilder) AddKeyValue ¶
func (u *UserAgentBuilder) AddKeyValue(key, value string)
AddKeyValue adds the named key to the agent string with the given value.
func (*UserAgentBuilder) Build ¶
func (u *UserAgentBuilder) Build() string
Build returns the constructed User-Agent string. May be called multiple times.
Source Files ¶
auth.go auth_schemes.go checksum_middleware.go client.go doc.go headerlist.go host.go interceptor.go interceptor_middleware.go md5_checksum.go metrics.go middleware_close_response_body.go middleware_content_length.go middleware_header_comment.go middleware_headers.go middleware_http_logging.go middleware_metadata.go middleware_min_proto.go properties.go request.go response.go time.go url.go user_agent.go
Directories ¶
| Path | Synopsis |
|---|---|
| transport/http/internal |
- Version
- v1.22.5 (latest)
- Published
- Jul 24, 2025
- Platform
- linux/amd64
- Imports
- 25 packages
- Last checked
- 9 months ago –
Tools for package owners.