acceptencoding

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package acceptencoding provides customizations associated with Accept Encoding Header.

Accept encoding gzip

The Go HTTP client automatically supports accept-encoding and content-encoding gzip by default. This default behavior is not desired by the SDK, and prevents validating the response body's checksum. To prevent this the SDK must manually control usage of content-encoding gzip.

To control content-encoding, the SDK must always set the `Accept-Encoding` header to a value. This prevents the HTTP client from using gzip automatically. When gzip is enabled on the API client, the SDK's customization will control decompressing the gzip data in order to not break the checksum validation. When gzip is disabled, the API client will disable gzip, preventing the HTTP client's default behavior.

An `EnableAcceptEncodingGzip` option may or may not be present depending on the client using the below middleware. The option if present can be used to enable auto decompressing gzip by the SDK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAcceptEncodingGzip

func AddAcceptEncodingGzip(stack *middleware.Stack, options AddAcceptEncodingGzipOptions)

AddAcceptEncodingGzip explicitly adds handling for accept-encoding GZIP middleware to the operation stack. This allows checksums to be correctly computed without disabling GZIP support.

Types

type AddAcceptEncodingGzipOptions

type AddAcceptEncodingGzipOptions struct {
	Enable bool
}

AddAcceptEncodingGzipOptions provides the options for the AddAcceptEncodingGzip middleware setup.

type DecompressGzipMiddleware

type DecompressGzipMiddleware struct{}

DecompressGzipMiddleware provides the middleware for decompressing a gzip response from the service.

func (*DecompressGzipMiddleware) HandleDeserialize

HandleDeserialize implements the DeserializeMiddlware interface.

func (*DecompressGzipMiddleware) ID

ID returns the id for the middleware.

type DisableGzipMiddleware

type DisableGzipMiddleware struct{}

DisableGzipMiddleware provides the middleware that will disable the underlying http client automatically enabling for gzip decompress content-encoding support.

func (*DisableGzipMiddleware) HandleFinalize

HandleFinalize implements the FinalizeMiddleware interface.

func (*DisableGzipMiddleware) ID

ID returns the id for the middleware.

type EnableGzipMiddleware

type EnableGzipMiddleware struct{}

EnableGzipMiddleware provides a middleware to enable support for gzip responses, with manual decompression. This prevents the underlying HTTP client from performing the gzip decompression automatically.

func (*EnableGzipMiddleware) HandleFinalize

HandleFinalize implements the FinalizeMiddlware interface.

func (*EnableGzipMiddleware) ID

ID returns the id for the middleware.

Jump to

Keyboard shortcuts

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