abstractions

package module
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 15 Imported by: 6,703

README

Kiota Abstractions Library for go

Go

The Kiota abstractions Library for go is the go library defining the basic constructs Kiota projects need once an SDK has been generated from an OpenAPI definition.

A Kiota generated project will need a reference to the abstraction package to build and run.

Read more about Kiota here.

Using the Abstractions Library

go get github.com/microsoft/kiota-abstractions-go

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Documentation

Overview

Package abstractions provides the base infrastructure for the Kiota-generated SDKs to function. It defines multiple concepts related to abstract HTTP requests, serialization, and authentication. These concepts can then be implemented independently without tying the SDKs to any specific implementation. Kiota also provides default implementations for these concepts. Checkout: - github.com/microsoft/kiota/authentication/go/azure - github.com/microsoft/kiota/http/go/nethttp - github.com/microsoft/kiota/serialization/go/json

Index

Constants

This section is empty.

Variables

View Source
var ResponseHandlerOptionKey = RequestOptionKey{
	Key: "ResponseHandlerOptionKey",
}

Functions

func CollectionApply added in v0.11.0

func CollectionApply[T any, R interface{}](collection []T, mutator func(t T) R) []R

CollectionApply applies an operation to every element of the slice and returns a result of the modified collection

is a slice of all the elementents to be mutated

mutator applies an operation to the collection and returns a response of type `R`

func CollectionCast added in v0.11.0

func CollectionCast[R interface{}, T any](items []T) []R

CollectionCast casts a collection of values from any type T to given type R

func CollectionStructCast added in v0.11.0

func CollectionStructCast[R interface{}, T any](items []T) []R

CollectionStructCast casts a collection of values from any type T to given type R

Value cast can be used to cast memory addresses to the value of the pointer

func CollectionValueCast added in v0.11.0

func CollectionValueCast[R interface{}, T any](items []T) []R

CollectionValueCast casts a collection of values from any type T to given type R

Value cast can be used to cast memory addresses to the value of the pointer

func ConfigureRequestInformation added in v1.5.0

func ConfigureRequestInformation[T any](request *RequestInformation, config *RequestConfiguration[T])

func CopyMap added in v0.18.0

func CopyMap[T comparable, R interface{}](items map[T]R) map[T]R

CopyMap returns a copy of map[string]string

func CopyStringMap added in v0.18.0

func CopyStringMap(items map[string]string) map[string]string

CopyStringMap returns a copy of map[string]string

func EnableBackingStoreForParseNodeFactory added in v0.17.0

func EnableBackingStoreForParseNodeFactory(factory s.ParseNodeFactory) s.ParseNodeFactory

EnableBackingStoreForParseNodeFactory Enables the backing store on default parse nodes factories and the given parse node factory.

func EnableBackingStoreForSerializationWriterFactory added in v0.17.0

func EnableBackingStoreForSerializationWriterFactory(factory s.SerializationWriterFactory) s.SerializationWriterFactory

EnableBackingStoreForSerializationWriterFactory Enables the backing store on default serialization writers and the given serialization writer.

func GetValueOrDefault added in v0.11.0

func GetValueOrDefault[T interface{}](source func() *T, defaultValue T) T

GetValueOrDefault Converts a Pointer to a value or returns a default value

func InvokeParsableAction added in v0.17.0

func InvokeParsableAction(action serialization.ParsableAction, parsable serialization.Parsable)

InvokeParsableAction nil safe execution of ParsableAction

func InvokeParsableWriter added in v0.17.0

func InvokeParsableWriter(writer serialization.ParsableWriter, parsable serialization.Parsable, serializer serialization.SerializationWriter) error

InvokeParsableWriter executes the ParsableAction in a nil safe way

func RegisterDefaultDeserializer

func RegisterDefaultDeserializer(metaFactory func() s.ParseNodeFactory)

RegisterDefaultDeserializer registers the default deserializer to the registry singleton to be used by the request adapter.

func RegisterDefaultSerializer

func RegisterDefaultSerializer(metaFactory func() s.SerializationWriterFactory)

RegisterDefaultSerializer registers the default serializer to the registry singleton to be used by the request adapter.

func SetBoolValue added in v0.11.0

func SetBoolValue(setter func(t *bool)) serialization.NodeParser

SetBoolValue returns a boolean prototype for deserialization

func SetByteArrayValue added in v0.11.0

func SetByteArrayValue(setter func(t []byte)) serialization.NodeParser

SetByteArrayValue returns a []byte prototype for deserialization

func SetByteValue added in v0.11.0

func SetByteValue(setter func(t *byte)) serialization.NodeParser

SetByteValue returns a byte prototype for deserialization

func SetCollectionOfEnumValues added in v0.11.0

func SetCollectionOfEnumValues[T interface{}](parser serialization.EnumFactory, setter func(t []T)) serialization.NodeParser

SetCollectionOfEnumValues returns an enum prototype for deserialization

func SetCollectionOfObjectValues added in v0.11.0

func SetCollectionOfObjectValues[T interface{}](ctor serialization.ParsableFactory, setter func(t []T)) serialization.NodeParser

SetCollectionOfObjectValues returns an objects collection prototype for deserialization

func SetCollectionOfPrimitiveValue added in v0.11.0

func SetCollectionOfPrimitiveValue[T interface{}](source func(targetType string) ([]interface{}, error), targetType string, setter func(t []T)) error

SetCollectionOfPrimitiveValue is a utility function that receives a collection of primitives , targetType and applies the result of the factory to a setter

source is any function that receives a `EnumFactory` and returns an interface or error targetType is a string representing the type of result setter is a recipient of the function results

func SetCollectionOfPrimitiveValues added in v0.11.0

func SetCollectionOfPrimitiveValues[T interface{}](targetType string, setter func(t []T)) serialization.NodeParser

SetCollectionOfPrimitiveValues returns a primitive's collection prototype for deserialization

func SetCollectionOfReferencedEnumValue added in v0.11.0

func SetCollectionOfReferencedEnumValue[T interface{}](source func(parser serialization.EnumFactory) ([]interface{}, error), parser serialization.EnumFactory, setter func(t []*T)) error

SetCollectionOfReferencedEnumValue is a utility function that receives an enum collection source , EnumFactory and applies a de-referenced result of the factory to a setter

source is any function that receives a `EnumFactory` and returns an interface or error parser is an EnumFactory setter is a recipient of the function results

func SetCollectionOfReferencedPrimitiveValue added in v0.11.0

func SetCollectionOfReferencedPrimitiveValue[T interface{}](source func(targetType string) ([]interface{}, error), targetType string, setter func(t []T)) error

SetCollectionOfReferencedPrimitiveValue is a utility function that receives a collection of primitives , targetType and applies the re-referenced result of the factory to a setter

source is any function that receives a `EnumFactory` and returns an interface or error parser is an EnumFactory setter is a recipient of the function results

func SetCollectionValue added in v0.11.0

func SetCollectionValue[T interface{}](source func(ctor serialization.ParsableFactory) ([]serialization.Parsable, error), ctor serialization.ParsableFactory, setter func(t []T)) error

SetCollectionValue is a utility function that receives a collection that can be cast to Parsable and a function that expects the results

source is any function that receives a `ParsableFactory` and returns a slice of Parsable or error ctor is a ParsableFactory setter is a recipient of the function results

func SetDateOnlyValue added in v0.11.0

func SetDateOnlyValue(setter func(t *serialization.DateOnly)) serialization.NodeParser

SetDateOnlyValue returns a DateOnly prototype for deserialization

func SetEnumValue added in v0.11.0

func SetEnumValue[T interface{}](parser serialization.EnumFactory, setter func(t *T)) serialization.NodeParser

SetEnumValue returns a Enum prototype for deserialization

func SetFloat32Value added in v0.11.0

func SetFloat32Value(setter func(t *float32)) serialization.NodeParser

SetFloat32Value returns a float32 prototype for deserialization

func SetFloat64Value added in v0.11.0

func SetFloat64Value(setter func(t *float64)) serialization.NodeParser

SetFloat64Value returns a float64 prototype for deserialization

func SetISODurationValue added in v0.11.0

func SetISODurationValue(setter func(t *serialization.ISODuration)) serialization.NodeParser

SetISODurationValue returns a ISODuration prototype for deserialization

func SetInt32Value added in v0.11.0

func SetInt32Value(setter func(t *int32)) serialization.NodeParser

SetInt32Value returns a int32 prototype for deserialization

func SetInt64Value added in v0.11.0

func SetInt64Value(setter func(t *int64)) serialization.NodeParser

SetInt64Value returns a int64 prototype for deserialization

func SetInt8Value added in v0.11.0

func SetInt8Value(setter func(t *int8)) serialization.NodeParser

SetInt8Value Returns an int8 prototype for deserialization

func SetObjectValue added in v0.11.0

func SetObjectValue[T interface{}](ctor serialization.ParsableFactory, setter func(t T)) serialization.NodeParser

SetObjectValue returns an object prototype for deserialization

func SetObjectValueFromSource added in v0.11.0

func SetObjectValueFromSource[T interface{}](source func(ctor serialization.ParsableFactory) (serialization.Parsable, error), ctor serialization.ParsableFactory, setter func(t T)) error

SetObjectValueFromSource takes a generic source with a discriminator receiver, reads value and writes it to a setter

`source func() (*T, error)` is a generic getter with possible error response. `setter func(t *T)` generic function that can write a value from the source

func SetReferencedEnumValue added in v0.11.0

func SetReferencedEnumValue[T interface{}](source func(parser serialization.EnumFactory) (interface{}, error), parser serialization.EnumFactory, setter func(t *T)) error

SetReferencedEnumValue is a utility function that receives an enum getter , EnumFactory and applies a de-referenced result of the factory to a setter

source is any function that receives a `EnumFactory` and returns an interface or error parser is an EnumFactory setter is a recipient of the function results

func SetStringValue added in v0.11.0

func SetStringValue(setter func(t *string)) serialization.NodeParser

SetStringValue returns a string prototype for deserialization

func SetTimeOnlyValue added in v0.11.0

func SetTimeOnlyValue(setter func(t *serialization.TimeOnly)) serialization.NodeParser

SetTimeOnlyValue returns a TimeOnly prototype for deserialization

func SetTimeValue added in v0.11.0

func SetTimeValue(setter func(t *time.Time)) serialization.NodeParser

SetTimeValue returns a time.Time prototype for deserialization

func SetUUIDValue added in v0.11.0

func SetUUIDValue(setter func(t *uuid.UUID)) serialization.NodeParser

SetUUIDValue returns a DateOnly prototype for deserialization

func SetValue added in v0.11.0

func SetValue[T interface{}](source func() (*T, error), setter func(t *T)) error

SetValue receives a source function and applies the results to the setter

source is any function that produces (*T, error) setter recipient function of the result of the source if no error is produces

Types

type ApiError

type ApiError struct {
	Message            string
	ResponseStatusCode int
	ResponseHeaders    *ResponseHeaders
}

ApiError is the parent type for errors thrown by the client when receiving failed responses to its requests

func NewApiError

func NewApiError() *ApiError

NewApiError creates a new ApiError instance

func (*ApiError) Error

func (e *ApiError) Error() string

func (*ApiError) SetResponseHeaders added in v1.5.2

func (e *ApiError) SetResponseHeaders(ResponseHeaders *ResponseHeaders)

func (*ApiError) SetStatusCode added in v1.5.2

func (e *ApiError) SetStatusCode(ResponseStatusCode int)

type ApiErrorable added in v1.5.2

type ApiErrorable interface {
	SetResponseHeaders(ResponseHeaders *ResponseHeaders)
	SetStatusCode(ResponseStatusCode int)
}

type BaseRequestBuilder added in v0.19.0

type BaseRequestBuilder struct {
	// Path parameters for the request
	PathParameters map[string]string
	// The request adapter to use to execute the requests.
	RequestAdapter RequestAdapter
	// Url template to use to build the URL for the current request builder
	UrlTemplate string
}

BaseRequestBuilder is the base class for all request builders.

func NewBaseRequestBuilder added in v0.19.0

func NewBaseRequestBuilder(requestAdapter RequestAdapter, urlTemplate string, pathParameters map[string]string) *BaseRequestBuilder

NewBaseRequestBuilder creates a new BaseRequestBuilder instance.

type DefaultQueryParameters added in v1.5.0

type DefaultQueryParameters struct {
}

DefaultQueryParameters is a placeholder for operations without any query parameter documented.

type ErrorMappings

type ErrorMappings map[string]s.ParsableFactory

ErrorMappings is a mapping of status codes to error types factories.

type HttpMethod

type HttpMethod int

Represents the HTTP method used by a request.

const (
	// The HTTP GET method.
	GET HttpMethod = iota
	// The HTTP POST method.
	POST
	// The HTTP PATCH method.
	PATCH
	// The HTTP DELETE method.
	DELETE
	// The HTTP OPTIONS method.
	OPTIONS
	// The HTTP CONNECT method.
	CONNECT
	// The HTTP PUT method.
	PUT
	// The HTTP TRACE method.
	TRACE
	// The HTTP HEAD method.
	HEAD
)

func (HttpMethod) String

func (m HttpMethod) String() string

String returns the string representation of the HTTP method.

type MultipartBody added in v1.2.0

type MultipartBody interface {
	serialization.Parsable
	// AddOrReplacePart adds or replaces a part in the multipart body.
	AddOrReplacePart(name string, contentType string, content any) error
	// GetPartValue gets the value of a part in the multipart body.
	GetPartValue(name string) (any, error)
	// RemovePart removes a part from the multipart body.
	RemovePart(name string) error
	// SetRequestAdapter sets the request adapter to use for serialization.
	SetRequestAdapter(requestAdapter RequestAdapter)
	// GetRequestAdapter gets the request adapter to use for serialization.
	GetRequestAdapter() RequestAdapter
	// GetBoundary returns the boundary used in the multipart body.
	GetBoundary() string
}

MultipartBody represents a multipart body for a request or a response.

func NewMultipartBody added in v1.2.0

func NewMultipartBody() MultipartBody

type RequestAdapter

type RequestAdapter interface {
	// Send executes the HTTP request specified by the given RequestInformation and returns the deserialized response model.
	Send(context context.Context, requestInfo *RequestInformation, constructor s.ParsableFactory, errorMappings ErrorMappings) (s.Parsable, error)
	// SendEnum executes the HTTP request specified by the given RequestInformation and returns the deserialized response model.
	SendEnum(context context.Context, requestInfo *RequestInformation, parser s.EnumFactory, errorMappings ErrorMappings) (any, error)
	// SendCollection executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection.
	SendCollection(context context.Context, requestInfo *RequestInformation, constructor s.ParsableFactory, errorMappings ErrorMappings) ([]s.Parsable, error)
	// SendEnumCollection executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection.
	SendEnumCollection(context context.Context, requestInfo *RequestInformation, parser s.EnumFactory, errorMappings ErrorMappings) ([]any, error)
	// SendPrimitive executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model.
	SendPrimitive(context context.Context, requestInfo *RequestInformation, typeName string, errorMappings ErrorMappings) (any, error)
	// SendPrimitiveCollection executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model collection.
	SendPrimitiveCollection(context context.Context, requestInfo *RequestInformation, typeName string, errorMappings ErrorMappings) ([]any, error)
	// SendNoContent executes the HTTP request specified by the given RequestInformation with no return content.
	SendNoContent(context context.Context, requestInfo *RequestInformation, errorMappings ErrorMappings) error
	// GetSerializationWriterFactory returns the serialization writer factory currently in use for the request adapter service.
	GetSerializationWriterFactory() s.SerializationWriterFactory
	// EnableBackingStore enables the backing store proxies for the SerializationWriters and ParseNodes in use.
	EnableBackingStore(factory store.BackingStoreFactory)
	// SetBaseUrl sets the base url for every request.
	SetBaseUrl(baseUrl string)
	// GetBaseUrl gets the base url for every request.
	GetBaseUrl() string
	// ConvertToNativeRequest converts the given RequestInformation into a native HTTP request.
	ConvertToNativeRequest(context context.Context, requestInfo *RequestInformation) (any, error)
}

RequestAdapter is the service responsible for translating abstract RequestInformation into native HTTP requests.

type RequestConfiguration added in v1.5.0

type RequestConfiguration[T any] struct {
	// Request headers
	Headers *RequestHeaders
	// Request options
	Options []RequestOption
	// Query parameters
	QueryParameters *T
}

RequestConfiguration represents a set of options to be used when making HTTP requests.

type RequestHandlerOption added in v0.9.1

type RequestHandlerOption interface {
	GetResponseHandler() ResponseHandler
	SetResponseHandler(responseHandler ResponseHandler)
	GetKey() RequestOptionKey
}

RequestHandlerOption represents an abstract provider for ResponseHandler

func NewRequestHandlerOption added in v0.9.1

func NewRequestHandlerOption() RequestHandlerOption

NewRequestHandlerOption creates a new RequestInformation object with default values.

type RequestHeaders added in v0.15.0

type RequestHeaders struct {
	// contains filtered or unexported fields
}

RequestHeaders represents a collection of request headers

func NewRequestHeaders added in v0.15.0

func NewRequestHeaders() *RequestHeaders

NewRequestHeaders creates a new RequestHeaders

func (*RequestHeaders) Add added in v0.15.0

func (r *RequestHeaders) Add(key string, value string, additionalValues ...string)

Add adds a new header or append a new value to an existing header

func (*RequestHeaders) AddAll added in v0.15.0

func (r *RequestHeaders) AddAll(other *RequestHeaders)

AddAll adds all headers from the other headers

func (*RequestHeaders) Clear added in v0.15.0

func (r *RequestHeaders) Clear()

Clear clear all headers

func (*RequestHeaders) ContainsKey added in v0.15.0

func (r *RequestHeaders) ContainsKey(key string) bool

ContainsKey check if the key exists in the headers

func (*RequestHeaders) Get added in v0.15.0

func (r *RequestHeaders) Get(key string) []string

Get returns the values for the specific header

func (*RequestHeaders) ListKeys added in v0.15.0

func (r *RequestHeaders) ListKeys() []string

ListKeys returns all the keys in the headers

func (*RequestHeaders) Remove added in v0.15.0

func (r *RequestHeaders) Remove(key string)

Remove removes the specific header and all its values

func (*RequestHeaders) RemoveValue added in v0.15.0

func (r *RequestHeaders) RemoveValue(key string, value string)

RemoveValue remove the value for the specific header

func (*RequestHeaders) TryAdd added in v1.2.3

func (r *RequestHeaders) TryAdd(key string, value string) bool

TryAdd adds the header if it's not already present

type RequestInformation

type RequestInformation struct {
	// The HTTP method of the request.
	Method HttpMethod

	// The Request Headers.
	Headers *RequestHeaders
	// The Query Parameters of the request.
	// Deprecated: use QueryParametersAny instead
	QueryParameters map[string]string
	// The Query Parameters of the request.
	QueryParametersAny map[string]any
	// The Request Body.
	Content []byte
	// The path parameters to use for the URL template when generating the URI.
	// Deprecated: use PathParametersAny instead
	PathParameters map[string]string
	// The path parameters to use for the URL template when generating the URI.
	PathParametersAny map[string]any
	// The Url template for the current request.
	UrlTemplate string
	// contains filtered or unexported fields
}

RequestInformation represents an abstract HTTP request.

func NewRequestInformation

func NewRequestInformation() *RequestInformation

NewRequestInformation creates a new RequestInformation object with default values.

func NewRequestInformationWithMethodAndUrlTemplateAndPathParameters added in v1.5.0

func NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(method HttpMethod, urlTemplate string, pathParameters map[string]string) *RequestInformation

NewRequestInformationWithMethodAndUrlTemplateAndPathParameters creates a new RequestInformation object with the specified method and URL template and path parameters.

func (*RequestInformation) AddQueryParameters

func (request *RequestInformation) AddQueryParameters(source any)

AddQueryParameters adds the query parameters to the request by reading the properties from the provided object.

func (*RequestInformation) AddRequestOptions

func (request *RequestInformation) AddRequestOptions(options []RequestOption)

AddRequestOptions adds an option to the request to be read by the middleware infrastructure.

func (*RequestInformation) GetRequestOptions

func (request *RequestInformation) GetRequestOptions() []RequestOption

GetRequestOptions returns the options for this request. Options are unique by type. If an option of the same type is added twice, the last one wins.

func (*RequestInformation) GetUri

func (request *RequestInformation) GetUri() (*u.URL, error)

GetUri returns the URI of the request.

func (*RequestInformation) SetContentFromParsable

func (request *RequestInformation) SetContentFromParsable(ctx context.Context, requestAdapter RequestAdapter, contentType string, item s.Parsable) error

SetContentFromParsable sets the request body from a model with the specified content type.

func (*RequestInformation) SetContentFromParsableCollection added in v0.14.0

func (request *RequestInformation) SetContentFromParsableCollection(ctx context.Context, requestAdapter RequestAdapter, contentType string, items []s.Parsable) error

SetContentFromParsableCollection sets the request body from a model with the specified content type.

func (*RequestInformation) SetContentFromScalar added in v0.6.0

func (request *RequestInformation) SetContentFromScalar(ctx context.Context, requestAdapter RequestAdapter, contentType string, item interface{}) error

SetContentFromScalar sets the request body from a scalar value with the specified content type.

func (*RequestInformation) SetContentFromScalarCollection added in v0.14.0

func (request *RequestInformation) SetContentFromScalarCollection(ctx context.Context, requestAdapter RequestAdapter, contentType string, items []interface{}) error

SetContentFromScalarCollection sets the request body from a scalar value with the specified content type.

func (*RequestInformation) SetStreamContent

func (request *RequestInformation) SetStreamContent(content []byte)

SetStreamContent sets the request body to a binary stream. Deprecated: Use SetStreamContentAndContentType instead.

func (*RequestInformation) SetStreamContentAndContentType added in v1.3.0

func (request *RequestInformation) SetStreamContentAndContentType(content []byte, contentType string)

SetStreamContentAndContentType sets the request body to a binary stream with the specified content type.

func (*RequestInformation) SetUri

func (request *RequestInformation) SetUri(url u.URL)

SetUri updates the URI for the request from a raw URL.

type RequestOption

type RequestOption interface {
	// GetKey returns the key to store the current option under.
	GetKey() RequestOptionKey
}

Represents a request option.

type RequestOptionKey

type RequestOptionKey struct {
	// The unique key for the option.
	Key string
}

RequestOptionKey represents a key to store a request option under.

type ResponseHandler

type ResponseHandler func(response interface{}, errorMappings ErrorMappings) (interface{}, error)

ResponseHandler handler to implement when a request's response should be handled a specific way.

type ResponseHeaders added in v0.20.0

type ResponseHeaders struct {
	// contains filtered or unexported fields
}

ResponseHeaders represents a collection of response headers

func NewResponseHeaders added in v0.20.0

func NewResponseHeaders() *ResponseHeaders

NewResponseHeaders creates a new ResponseHeaders

func (*ResponseHeaders) Add added in v0.20.0

func (r *ResponseHeaders) Add(key string, value string, additionalValues ...string)

Add adds a new header or append a new value to an existing header

func (*ResponseHeaders) AddAll added in v0.20.0

func (r *ResponseHeaders) AddAll(other *ResponseHeaders)

AddAll adds all headers from the other headers

func (*ResponseHeaders) Clear added in v0.20.0

func (r *ResponseHeaders) Clear()

Clear clear all headers

func (*ResponseHeaders) ContainsKey added in v0.20.0

func (r *ResponseHeaders) ContainsKey(key string) bool

ContainsKey check if the key exists in the headers

func (*ResponseHeaders) Get added in v0.20.0

func (r *ResponseHeaders) Get(key string) []string

Get returns the values for the specific header

func (*ResponseHeaders) ListKeys added in v0.20.0

func (r *ResponseHeaders) ListKeys() []string

ListKeys returns all the keys in the headers

func (*ResponseHeaders) Remove added in v0.20.0

func (r *ResponseHeaders) Remove(key string)

Remove removes the specific header and all its values

func (*ResponseHeaders) RemoveValue added in v0.20.0

func (r *ResponseHeaders) RemoveValue(key string, value string)

RemoveValue remove the value for the specific header

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL