Documentation ¶
Overview ¶
Package nethttplibrary implements the Kiota abstractions with net/http to execute the requests. It also provides a middleware infrastructure with some default middleware handlers like the retry handler and the redirect handler.
Index ¶
- Constants
- func GetClientWithAuthenticatedProxySettings(proxyUrlStr string, username string, password string, middleware ...Middleware) (*nethttp.Client, error)
- func GetClientWithProxySettings(proxyUrlStr string, middleware ...Middleware) (*nethttp.Client, error)
- func GetDefaultClient(middleware ...Middleware) *nethttp.Client
- func GetDefaultTransport() nethttp.RoundTripper
- func NewCustomTransport(middlewares ...Middleware) *customTransport
- func NewCustomTransportWithParentTransport(parentTransport nethttp.RoundTripper, middlewares ...Middleware) *customTransport
- func NopCloser(r io.ReadSeeker) io.ReadSeekCloser
- func ReplacePathTokens(path string, replacementPairs map[string]string) string
- type ChaosHandler
- type ChaosHandlerOptions
- func (handlerOptions *ChaosHandlerOptions) GetBaseUrl() string
- func (handlerOptions *ChaosHandlerOptions) GetChaosPercentage() int
- func (handlerOptions *ChaosHandlerOptions) GetChaosStrategy() ChaosStrategy
- func (handlerOptions *ChaosHandlerOptions) GetHeaders() map[string][]string
- func (handlerOptions *ChaosHandlerOptions) GetKey() abstractions.RequestOptionKey
- func (handlerOptions *ChaosHandlerOptions) GetResponseBody() *nethttp.Response
- func (handlerOptions *ChaosHandlerOptions) GetStatusCode() int
- func (handlerOptions *ChaosHandlerOptions) GetStatusMap() map[string]map[string]int
- func (handlerOptions *ChaosHandlerOptions) GetStatusMessage() string
- type ChaosStrategy
- type CompressionHandler
- type CompressionOptions
- type HeadersInspectionHandler
- type HeadersInspectionOptions
- func (o *HeadersInspectionOptions) GetInspectRequestHeaders() bool
- func (o *HeadersInspectionOptions) GetInspectResponseHeaders() bool
- func (o *HeadersInspectionOptions) GetKey() abstractions.RequestOptionKey
- func (o *HeadersInspectionOptions) GetRequestHeaders() *abstractions.RequestHeaders
- func (o *HeadersInspectionOptions) GetResponseHeaders() *abstractions.ResponseHeaders
- type Middleware
- type NetHttpRequestAdapter
- func NewNetHttpRequestAdapter(authenticationProvider absauth.AuthenticationProvider) (*NetHttpRequestAdapter, error)
- func NewNetHttpRequestAdapterWithParseNodeFactory(authenticationProvider absauth.AuthenticationProvider, ...) (*NetHttpRequestAdapter, error)
- func NewNetHttpRequestAdapterWithParseNodeFactoryAndSerializationWriterFactory(authenticationProvider absauth.AuthenticationProvider, ...) (*NetHttpRequestAdapter, error)
- func NewNetHttpRequestAdapterWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClient(authenticationProvider absauth.AuthenticationProvider, ...) (*NetHttpRequestAdapter, error)
- func NewNetHttpRequestAdapterWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClientAndObservabilityOptions(authenticationProvider absauth.AuthenticationProvider, ...) (*NetHttpRequestAdapter, error)
- func (a *NetHttpRequestAdapter) ConvertToNativeRequest(context context.Context, requestInfo *abs.RequestInformation) (any, error)
- func (a *NetHttpRequestAdapter) EnableBackingStore(factory store.BackingStoreFactory)
- func (a *NetHttpRequestAdapter) GetBaseUrl() string
- func (a *NetHttpRequestAdapter) GetSerializationWriterFactory() absser.SerializationWriterFactory
- func (a *NetHttpRequestAdapter) Send(ctx context.Context, requestInfo *abs.RequestInformation, ...) (absser.Parsable, error)
- func (a *NetHttpRequestAdapter) SendCollection(ctx context.Context, requestInfo *abs.RequestInformation, ...) ([]absser.Parsable, error)
- func (a *NetHttpRequestAdapter) SendEnum(ctx context.Context, requestInfo *abs.RequestInformation, ...) (any, error)
- func (a *NetHttpRequestAdapter) SendEnumCollection(ctx context.Context, requestInfo *abs.RequestInformation, ...) ([]any, error)
- func (a *NetHttpRequestAdapter) SendNoContent(ctx context.Context, requestInfo *abs.RequestInformation, ...) error
- func (a *NetHttpRequestAdapter) SendPrimitive(ctx context.Context, requestInfo *abs.RequestInformation, typeName string, ...) (any, error)
- func (a *NetHttpRequestAdapter) SendPrimitiveCollection(ctx context.Context, requestInfo *abs.RequestInformation, typeName string, ...) ([]any, error)
- func (a *NetHttpRequestAdapter) SetBaseUrl(baseUrl string)
- type ObservabilityOptions
- type ObservabilityOptionsInt
- type ParametersNameDecodingHandler
- type ParametersNameDecodingOptions
- type Pipeline
- type RedirectHandler
- type RedirectHandlerOptions
- type RetryHandler
- type RetryHandlerOptions
- type UrlReplaceHandler
- type UrlReplaceOptions
- type UserAgentHandler
- type UserAgentHandlerOptions
Constants ¶
const AuthenticateChallengedEventKey = "com.microsoft.kiota.authenticate_challenge_received"
const ChaosHandlerTriggeredEventKey = "com.microsoft.kiota.chaos_handler_triggered"
ChaosHandlerTriggeredEventKey is the key used for the open telemetry event
const ErrorBodyFoundAttributeName = "com.microsoft.kiota.error.body_found"
ErrorBodyFoundAttributeName is the attribute name used to indicate whether the error response contained a body
const ErrorMappingFoundAttributeName = "com.microsoft.kiota.error.mapping_found"
ErrorMappingFoundAttributeName is the attribute name used to indicate whether an error code mapping was found.
const EventResponseHandlerInvokedKey = "com.microsoft.kiota.response_handler_invoked"
Variables ¶
This section is empty.
Functions ¶
func GetClientWithAuthenticatedProxySettings ¶ added in v0.8.0
func GetClientWithAuthenticatedProxySettings(proxyUrlStr string, username string, password string, middleware ...Middleware) (*nethttp.Client, error)
GetClientWithAuthenticatedProxySettings creates a new default net/http client with a proxy url and default middleware Not providing any middleware would result in having default middleware provided
func GetClientWithProxySettings ¶ added in v0.8.0
func GetClientWithProxySettings(proxyUrlStr string, middleware ...Middleware) (*nethttp.Client, error)
GetClientWithProxySettings creates a new default net/http client with a proxy url and default middleware Not providing any middleware would result in having default middleware provided
func GetDefaultClient ¶
func GetDefaultClient(middleware ...Middleware) *nethttp.Client
GetDefaultClient creates a new default net/http client with the options configured for the Kiota request adapter
func GetDefaultTransport ¶
func GetDefaultTransport() nethttp.RoundTripper
GetDefaultTransport returns the default http transport used by the library
func NewCustomTransport ¶
func NewCustomTransport(middlewares ...Middleware) *customTransport
NewCustomTransport creates a new custom transport for http client with the provided set of middleware
func NewCustomTransportWithParentTransport ¶
func NewCustomTransportWithParentTransport(parentTransport nethttp.RoundTripper, middlewares ...Middleware) *customTransport
NewCustomTransportWithParentTransport creates a new custom transport which relies on the provided transport for http client with the provided set of middleware
func NopCloser ¶ added in v0.11.0
func NopCloser(r io.ReadSeeker) io.ReadSeekCloser
Types ¶
type ChaosHandler ¶ added in v0.6.0
type ChaosHandler struct {
// contains filtered or unexported fields
}
func NewChaosHandler ¶ added in v0.6.0
func NewChaosHandler() *ChaosHandler
NewChaosHandler creates a new ChaosHandler with default configuration options of Random errors at 10%
func NewChaosHandlerWithOptions ¶ added in v0.6.0
func NewChaosHandlerWithOptions(handlerOptions *ChaosHandlerOptions) (*ChaosHandler, error)
NewChaosHandlerWithOptions creates a new ChaosHandler with the configured options
type ChaosHandlerOptions ¶ added in v0.6.0
type ChaosHandlerOptions struct { BaseUrl string ChaosStrategy ChaosStrategy StatusCode int StatusMessage string ChaosPercentage int ResponseBody *nethttp.Response Headers map[string][]string StatusMap map[string]map[string]int }
ChaosHandlerOptions is a configuration struct holding behavior defined options for a chaos handler
BaseUrl represent the host url for in ChaosStrategy Specifies the strategy used for the Testing Handler -> RANDOM/MANUAL StatusCode Status code to be returned as part of the error response StatusMessage Message to be returned as part of the error response ChaosPercentage The percentage of randomness/chaos in the handler ResponseBody The response body to be returned as part of the error response Headers The response headers to be returned as part of the error response StatusMap The Map passed by user containing url-statusCode info
func (*ChaosHandlerOptions) GetBaseUrl ¶ added in v0.6.0
func (handlerOptions *ChaosHandlerOptions) GetBaseUrl() string
func (*ChaosHandlerOptions) GetChaosPercentage ¶ added in v0.6.0
func (handlerOptions *ChaosHandlerOptions) GetChaosPercentage() int
func (*ChaosHandlerOptions) GetChaosStrategy ¶ added in v0.6.0
func (handlerOptions *ChaosHandlerOptions) GetChaosStrategy() ChaosStrategy
func (*ChaosHandlerOptions) GetHeaders ¶ added in v0.6.0
func (handlerOptions *ChaosHandlerOptions) GetHeaders() map[string][]string
func (*ChaosHandlerOptions) GetKey ¶ added in v0.6.0
func (handlerOptions *ChaosHandlerOptions) GetKey() abstractions.RequestOptionKey
GetKey returns ChaosHandlerOptions unique name in context object
func (*ChaosHandlerOptions) GetResponseBody ¶ added in v0.6.0
func (handlerOptions *ChaosHandlerOptions) GetResponseBody() *nethttp.Response
func (*ChaosHandlerOptions) GetStatusCode ¶ added in v0.6.0
func (handlerOptions *ChaosHandlerOptions) GetStatusCode() int
func (*ChaosHandlerOptions) GetStatusMap ¶ added in v0.6.0
func (handlerOptions *ChaosHandlerOptions) GetStatusMap() map[string]map[string]int
func (*ChaosHandlerOptions) GetStatusMessage ¶ added in v0.6.0
func (handlerOptions *ChaosHandlerOptions) GetStatusMessage() string
type ChaosStrategy ¶ added in v0.6.0
type ChaosStrategy int
const ( Manual ChaosStrategy = iota Random )
type CompressionHandler ¶
type CompressionHandler struct {
// contains filtered or unexported fields
}
CompressionHandler represents a compression middleware
func NewCompressionHandler ¶
func NewCompressionHandler() *CompressionHandler
NewCompressionHandler creates an instance of a compression middleware
func NewCompressionHandlerWithOptions ¶
func NewCompressionHandlerWithOptions(option CompressionOptions) *CompressionHandler
NewCompressionHandlerWithOptions creates an instance of the compression middleware with specified configurations.
type CompressionOptions ¶
type CompressionOptions struct {
// contains filtered or unexported fields
}
CompressionOptions is a configuration object for the CompressionHandler middleware
func NewCompressionOptions ¶
func NewCompressionOptions(enableCompression bool) CompressionOptions
NewCompressionOptions creates a configuration object for the CompressionHandler
func (CompressionOptions) GetKey ¶
func (o CompressionOptions) GetKey() abstractions.RequestOptionKey
GetKey returns CompressionOptions unique name in context object
func (CompressionOptions) ShouldCompress ¶
func (o CompressionOptions) ShouldCompress() bool
ShouldCompress reads compression setting form CompressionOptions
type HeadersInspectionHandler ¶ added in v1.1.0
type HeadersInspectionHandler struct {
// contains filtered or unexported fields
}
HeadersInspectionHandler allows inspecting of the headers of the request and response via a request option
func NewHeadersInspectionHandler ¶ added in v1.1.0
func NewHeadersInspectionHandler() *HeadersInspectionHandler
NewHeadersInspectionHandler creates a new HeadersInspectionHandler with default options
func NewHeadersInspectionHandlerWithOptions ¶ added in v1.1.0
func NewHeadersInspectionHandlerWithOptions(options HeadersInspectionOptions) *HeadersInspectionHandler
NewHeadersInspectionHandlerWithOptions creates a new HeadersInspectionHandler with the given options
type HeadersInspectionOptions ¶ added in v1.1.0
type HeadersInspectionOptions struct { InspectRequestHeaders bool InspectResponseHeaders bool RequestHeaders *abstractions.RequestHeaders ResponseHeaders *abstractions.ResponseHeaders }
HeadersInspectionHandlerOptions is the options to use when inspecting headers
func NewHeadersInspectionOptions ¶ added in v1.1.0
func NewHeadersInspectionOptions() *HeadersInspectionOptions
NewHeadersInspectionOptions creates a new HeadersInspectionOptions with default options
func (*HeadersInspectionOptions) GetInspectRequestHeaders ¶ added in v1.1.0
func (o *HeadersInspectionOptions) GetInspectRequestHeaders() bool
GetInspectRequestHeaders returns true if the request headers should be inspected
func (*HeadersInspectionOptions) GetInspectResponseHeaders ¶ added in v1.1.0
func (o *HeadersInspectionOptions) GetInspectResponseHeaders() bool
GetInspectResponseHeaders returns true if the response headers should be inspected
func (*HeadersInspectionOptions) GetKey ¶ added in v1.1.0
func (o *HeadersInspectionOptions) GetKey() abstractions.RequestOptionKey
GetKey returns the key for the HeadersInspectionOptions
func (*HeadersInspectionOptions) GetRequestHeaders ¶ added in v1.1.0
func (o *HeadersInspectionOptions) GetRequestHeaders() *abstractions.RequestHeaders
GetRequestHeaders returns the request headers
func (*HeadersInspectionOptions) GetResponseHeaders ¶ added in v1.1.0
func (o *HeadersInspectionOptions) GetResponseHeaders() *abstractions.ResponseHeaders
GetResponseHeaders returns the response headers
type Middleware ¶
type Middleware interface { // Intercept intercepts the request and returns the response. The implementer MUST call pipeline.Next() Intercept(Pipeline, int, *nethttp.Request) (*nethttp.Response, error) }
Middleware interface for cross cutting concerns with HTTP requests and responses.
func GetDefaultMiddlewares ¶
func GetDefaultMiddlewares() []Middleware
GetDefaultMiddlewares creates a new default set of middlewares for the Kiota request adapter
func GetDefaultMiddlewaresWithOptions ¶ added in v1.3.0
func GetDefaultMiddlewaresWithOptions(requestOptions ...abs.RequestOption) ([]Middleware, error)
GetDefaultMiddlewaresWithOptions creates a new default set of middlewares for the Kiota request adapter with options
type NetHttpRequestAdapter ¶
type NetHttpRequestAdapter struct {
// contains filtered or unexported fields
}
NetHttpRequestAdapter implements the RequestAdapter interface using net/http
func NewNetHttpRequestAdapter ¶
func NewNetHttpRequestAdapter(authenticationProvider absauth.AuthenticationProvider) (*NetHttpRequestAdapter, error)
NewNetHttpRequestAdapter creates a new NetHttpRequestAdapter with the given parameters
func NewNetHttpRequestAdapterWithParseNodeFactory ¶
func NewNetHttpRequestAdapterWithParseNodeFactory(authenticationProvider absauth.AuthenticationProvider, parseNodeFactory absser.ParseNodeFactory) (*NetHttpRequestAdapter, error)
NewNetHttpRequestAdapterWithParseNodeFactory creates a new NetHttpRequestAdapter with the given parameters
func NewNetHttpRequestAdapterWithParseNodeFactoryAndSerializationWriterFactory ¶
func NewNetHttpRequestAdapterWithParseNodeFactoryAndSerializationWriterFactory(authenticationProvider absauth.AuthenticationProvider, parseNodeFactory absser.ParseNodeFactory, serializationWriterFactory absser.SerializationWriterFactory) (*NetHttpRequestAdapter, error)
NewNetHttpRequestAdapterWithParseNodeFactoryAndSerializationWriterFactory creates a new NetHttpRequestAdapter with the given parameters
func NewNetHttpRequestAdapterWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClient ¶
func NewNetHttpRequestAdapterWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClient(authenticationProvider absauth.AuthenticationProvider, parseNodeFactory absser.ParseNodeFactory, serializationWriterFactory absser.SerializationWriterFactory, httpClient *nethttp.Client) (*NetHttpRequestAdapter, error)
NewNetHttpRequestAdapterWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClient creates a new NetHttpRequestAdapter with the given parameters
func NewNetHttpRequestAdapterWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClientAndObservabilityOptions ¶ added in v0.9.0
func NewNetHttpRequestAdapterWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClientAndObservabilityOptions(authenticationProvider absauth.AuthenticationProvider, parseNodeFactory absser.ParseNodeFactory, serializationWriterFactory absser.SerializationWriterFactory, httpClient *nethttp.Client, observabilityOptions ObservabilityOptions) (*NetHttpRequestAdapter, error)
NewNetHttpRequestAdapterWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClientAndObservabilityOptions creates a new NetHttpRequestAdapter with the given parameters
func (*NetHttpRequestAdapter) ConvertToNativeRequest ¶ added in v0.13.0
func (a *NetHttpRequestAdapter) ConvertToNativeRequest(context context.Context, requestInfo *abs.RequestInformation) (any, error)
ConvertToNativeRequest converts the given RequestInformation into a native HTTP request.
func (*NetHttpRequestAdapter) EnableBackingStore ¶
func (a *NetHttpRequestAdapter) EnableBackingStore(factory store.BackingStoreFactory)
EnableBackingStore enables the backing store proxies for the SerializationWriters and ParseNodes in use.
func (*NetHttpRequestAdapter) GetBaseUrl ¶
func (a *NetHttpRequestAdapter) GetBaseUrl() string
GetBaseUrl gets the base url for every request.
func (*NetHttpRequestAdapter) GetSerializationWriterFactory ¶
func (a *NetHttpRequestAdapter) GetSerializationWriterFactory() absser.SerializationWriterFactory
GetSerializationWriterFactory returns the serialization writer factory currently in use for the request adapter service.
func (*NetHttpRequestAdapter) Send ¶ added in v0.13.0
func (a *NetHttpRequestAdapter) Send(ctx context.Context, requestInfo *abs.RequestInformation, constructor absser.ParsableFactory, errorMappings abs.ErrorMappings) (absser.Parsable, error)
Send executes the HTTP request specified by the given RequestInformation and returns the deserialized response model.
func (*NetHttpRequestAdapter) SendCollection ¶ added in v0.13.0
func (a *NetHttpRequestAdapter) SendCollection(ctx context.Context, requestInfo *abs.RequestInformation, constructor absser.ParsableFactory, errorMappings abs.ErrorMappings) ([]absser.Parsable, error)
SendCollection executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection.
func (*NetHttpRequestAdapter) SendEnum ¶ added in v0.13.0
func (a *NetHttpRequestAdapter) SendEnum(ctx context.Context, requestInfo *abs.RequestInformation, parser absser.EnumFactory, errorMappings abs.ErrorMappings) (any, error)
SendEnum executes the HTTP request specified by the given RequestInformation and returns the deserialized response model.
func (*NetHttpRequestAdapter) SendEnumCollection ¶ added in v0.13.0
func (a *NetHttpRequestAdapter) SendEnumCollection(ctx context.Context, requestInfo *abs.RequestInformation, parser absser.EnumFactory, errorMappings abs.ErrorMappings) ([]any, error)
SendEnumCollection executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection.
func (*NetHttpRequestAdapter) SendNoContent ¶ added in v0.13.0
func (a *NetHttpRequestAdapter) SendNoContent(ctx context.Context, requestInfo *abs.RequestInformation, errorMappings abs.ErrorMappings) error
SendNoContent executes the HTTP request specified by the given RequestInformation with no return content.
func (*NetHttpRequestAdapter) SendPrimitive ¶ added in v0.13.0
func (a *NetHttpRequestAdapter) SendPrimitive(ctx context.Context, requestInfo *abs.RequestInformation, typeName string, errorMappings abs.ErrorMappings) (any, error)
SendPrimitive executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model.
func (*NetHttpRequestAdapter) SendPrimitiveCollection ¶ added in v0.13.0
func (a *NetHttpRequestAdapter) SendPrimitiveCollection(ctx context.Context, requestInfo *abs.RequestInformation, typeName string, errorMappings abs.ErrorMappings) ([]any, error)
SendPrimitiveCollection executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model collection.
func (*NetHttpRequestAdapter) SetBaseUrl ¶
func (a *NetHttpRequestAdapter) SetBaseUrl(baseUrl string)
SetBaseUrl sets the base url for every request.
type ObservabilityOptions ¶ added in v0.9.0
type ObservabilityOptions struct { // Whether to include attributes which could contains EUII information like URLs IncludeEUIIAttributes bool }
ObservabilityOptions holds the tracing, metrics and logging configuration for the request adapter
func (*ObservabilityOptions) GetIncludeEUIIAttributes ¶ added in v0.9.0
func (o *ObservabilityOptions) GetIncludeEUIIAttributes() bool
GetIncludeEUIIAttributes returns whether to include attributes which could contains EUII information
func (*ObservabilityOptions) GetKey ¶ added in v0.9.0
func (*ObservabilityOptions) GetKey() abs.RequestOptionKey
func (*ObservabilityOptions) GetTracerInstrumentationName ¶ added in v0.9.0
func (o *ObservabilityOptions) GetTracerInstrumentationName() string
GetTracerInstrumentationName returns the observability name to use for the tracer
func (*ObservabilityOptions) SetIncludeEUIIAttributes ¶ added in v0.9.0
func (o *ObservabilityOptions) SetIncludeEUIIAttributes(value bool)
SetIncludeEUIIAttributes set whether to include attributes which could contains EUII information
type ObservabilityOptionsInt ¶ added in v0.9.0
type ObservabilityOptionsInt interface { abs.RequestOption GetTracerInstrumentationName() string GetIncludeEUIIAttributes() bool SetIncludeEUIIAttributes(value bool) }
ObservabilityOptionsInt defines the options contract for handlers
func GetObservabilityOptionsFromRequest ¶ added in v0.9.0
func GetObservabilityOptionsFromRequest(req *nethttp.Request) ObservabilityOptionsInt
GetObservabilityOptionsFromRequest returns the observability options from the request context
type ParametersNameDecodingHandler ¶ added in v0.2.0
type ParametersNameDecodingHandler struct {
// contains filtered or unexported fields
}
ParametersNameDecodingHandler decodes special characters in the request query parameters that had to be encoded due to RFC 6570 restrictions names before executing the request.
func NewParametersNameDecodingHandler ¶ added in v0.2.0
func NewParametersNameDecodingHandler() *ParametersNameDecodingHandler
NewParametersNameDecodingHandler creates a new ParametersNameDecodingHandler with default options
func NewParametersNameDecodingHandlerWithOptions ¶ added in v0.2.0
func NewParametersNameDecodingHandlerWithOptions(options ParametersNameDecodingOptions) *ParametersNameDecodingHandler
NewParametersNameDecodingHandlerWithOptions creates a new ParametersNameDecodingHandler with the given options
type ParametersNameDecodingOptions ¶ added in v0.2.0
type ParametersNameDecodingOptions struct { // Enable defines if the parameters name decoding should be enabled Enable bool // ParametersToDecode defines the characters that should be decoded ParametersToDecode []byte }
ParametersNameDecodingOptions defines the options for the ParametersNameDecodingHandler
func (*ParametersNameDecodingOptions) GetEnable ¶ added in v0.2.0
func (options *ParametersNameDecodingOptions) GetEnable() bool
GetEnable returns the enable value from the option
func (*ParametersNameDecodingOptions) GetKey ¶ added in v0.2.0
func (options *ParametersNameDecodingOptions) GetKey() abs.RequestOptionKey
GetKey returns the key value to be used when the option is added to the request context
func (*ParametersNameDecodingOptions) GetParametersToDecode ¶ added in v0.2.0
func (options *ParametersNameDecodingOptions) GetParametersToDecode() []byte
GetParametersToDecode returns the parametersToDecode value from the option
type Pipeline ¶
type Pipeline interface { // Next moves the request object through middlewares in the pipeline Next(req *nethttp.Request, middlewareIndex int) (*nethttp.Response, error) }
Pipeline contract for middleware infrastructure
type RedirectHandler ¶
type RedirectHandler struct {
// contains filtered or unexported fields
}
RedirectHandler handles redirect responses and follows them according to the options specified.
func NewRedirectHandler ¶
func NewRedirectHandler() *RedirectHandler
NewRedirectHandler creates a new redirect handler with the default options.
func NewRedirectHandlerWithOptions ¶
func NewRedirectHandlerWithOptions(options RedirectHandlerOptions) *RedirectHandler
NewRedirectHandlerWithOptions creates a new redirect handler with the specified options.
type RedirectHandlerOptions ¶
type RedirectHandlerOptions struct { // A callback that determines whether to redirect or not. ShouldRedirect func(req *nethttp.Request, res *nethttp.Response) bool // The maximum number of redirects to follow. MaxRedirects int }
RedirectHandlerOptions to use when evaluating whether to redirect or not.
func (*RedirectHandlerOptions) GetKey ¶
func (options *RedirectHandlerOptions) GetKey() abs.RequestOptionKey
GetKey returns the key value to be used when the option is added to the request context
func (*RedirectHandlerOptions) GetMaxRedirect ¶
func (options *RedirectHandlerOptions) GetMaxRedirect() int
GetMaxRedirect returns the maximum number of redirects to follow.
func (*RedirectHandlerOptions) GetShouldRedirect ¶
func (options *RedirectHandlerOptions) GetShouldRedirect() func(req *nethttp.Request, res *nethttp.Response) bool
GetShouldRedirect returns the redirection evaluation function.
type RetryHandler ¶
type RetryHandler struct {
// contains filtered or unexported fields
}
RetryHandler handles transient HTTP responses and retries the request given the retry options
func NewRetryHandler ¶
func NewRetryHandler() *RetryHandler
NewRetryHandler creates a new RetryHandler with default options
func NewRetryHandlerWithOptions ¶
func NewRetryHandlerWithOptions(options RetryHandlerOptions) *RetryHandler
NewRetryHandlerWithOptions creates a new RetryHandler with the given options
type RetryHandlerOptions ¶
type RetryHandlerOptions struct { // Callback to determine if the request should be retried ShouldRetry func(delay time.Duration, executionCount int, request *nethttp.Request, response *nethttp.Response) bool // The maximum number of times a request can be retried MaxRetries int // The delay in seconds between retries DelaySeconds int }
RetryHandlerOptions to apply when evaluating the response for retrial
func (*RetryHandlerOptions) GetDelaySeconds ¶
func (options *RetryHandlerOptions) GetDelaySeconds() int
GetDelaySeconds returns the delays in seconds between retries
func (*RetryHandlerOptions) GetKey ¶
func (options *RetryHandlerOptions) GetKey() abs.RequestOptionKey
GetKey returns the key value to be used when the option is added to the request context
func (*RetryHandlerOptions) GetMaxRetries ¶
func (options *RetryHandlerOptions) GetMaxRetries() int
GetMaxRetries returns the maximum number of times a request can be retried
func (*RetryHandlerOptions) GetShouldRetry ¶
func (options *RetryHandlerOptions) GetShouldRetry() func(delay time.Duration, executionCount int, request *nethttp.Request, response *nethttp.Response) bool
GetShouldRetry returns the should retry callback function which evaluates the response for retrial
type UrlReplaceHandler ¶ added in v0.15.0
type UrlReplaceHandler struct {
// contains filtered or unexported fields
}
UrlReplaceHandler is a middleware handler that replaces url segments in the uri path.
func NewUrlReplaceHandler ¶ added in v0.15.0
func NewUrlReplaceHandler(enabled bool, replacementPairs map[string]string) *UrlReplaceHandler
NewUrlReplaceHandler creates a configuration object for the CompressionHandler
type UrlReplaceOptions ¶ added in v0.15.0
UrlReplaceOptions is a configuration object for the UrlReplaceHandler middleware
func (*UrlReplaceOptions) GetKey ¶ added in v0.15.0
func (u *UrlReplaceOptions) GetKey() abstractions.RequestOptionKey
GetKey returns UrlReplaceOptions unique name in context object
func (*UrlReplaceOptions) GetReplacementPairs ¶ added in v0.15.0
func (u *UrlReplaceOptions) GetReplacementPairs() map[string]string
GetReplacementPairs reads ReplacementPairs settings from UrlReplaceOptions
func (*UrlReplaceOptions) IsEnabled ¶ added in v0.15.0
func (u *UrlReplaceOptions) IsEnabled() bool
IsEnabled reads Enabled setting from UrlReplaceOptions
type UserAgentHandler ¶ added in v0.12.0
type UserAgentHandler struct {
// contains filtered or unexported fields
}
UserAgentHandler adds the product to the user agent header.
func NewUserAgentHandler ¶ added in v0.12.0
func NewUserAgentHandler() *UserAgentHandler
NewUserAgentHandler creates a new user agent handler with the default options.
func NewUserAgentHandlerWithOptions ¶ added in v0.12.0
func NewUserAgentHandlerWithOptions(options *UserAgentHandlerOptions) *UserAgentHandler
NewUserAgentHandlerWithOptions creates a new user agent handler with the specified options.
type UserAgentHandlerOptions ¶ added in v0.12.0
UserAgentHandlerOptions to use when adding the product to the user agent header.
func NewUserAgentHandlerOptions ¶ added in v0.12.0
func NewUserAgentHandlerOptions() *UserAgentHandlerOptions
NewUserAgentHandlerOptions creates a new user agent handler options with the default values.
func (*UserAgentHandlerOptions) GetEnabled ¶ added in v0.12.0
func (options *UserAgentHandlerOptions) GetEnabled() bool
GetEnabled returns the value of the enabled property
func (*UserAgentHandlerOptions) GetKey ¶ added in v0.12.0
func (options *UserAgentHandlerOptions) GetKey() abs.RequestOptionKey
GetKey returns the key value to be used when the option is added to the request context
func (*UserAgentHandlerOptions) GetProductName ¶ added in v0.12.0
func (options *UserAgentHandlerOptions) GetProductName() string
GetProductName returns the value of the product name property
func (*UserAgentHandlerOptions) GetProductVersion ¶ added in v0.12.0
func (options *UserAgentHandlerOptions) GetProductVersion() string
GetProductVersion returns the value of the product version property
Source Files ¶
- chaos_handler.go
- compression_handler.go
- headers_inspection_handler.go
- kiota_client_factory.go
- middleware.go
- nethttp_request_adapter.go
- observability_options.go
- parameters_name_decoding_handler.go
- pipeline.go
- redirect_handler.go
- retry_handler.go
- span_attributes.go
- url_replace_handler.go
- user_agent_handler.go