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) error

    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 DecompressGzip

      type DecompressGzip struct{}

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

        func (*DecompressGzip) HandleDeserialize

          HandleDeserialize implements the DeserializeMiddlware interface.

          func (*DecompressGzip) ID

          func (*DecompressGzip) ID() string

            ID returns the id for the middleware.

            type DisableGzip

            type DisableGzip struct{}

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

              func (*DisableGzip) HandleFinalize

              func (*DisableGzip) HandleFinalize(
              	ctx context.Context, input middleware.FinalizeInput, next middleware.FinalizeHandler,
              ) (
              	output middleware.FinalizeOutput, metadata middleware.Metadata, err error,
              )

                HandleFinalize implements the FinalizeMiddleware interface.

                func (*DisableGzip) ID

                func (*DisableGzip) ID() string

                  ID returns the id for the middleware.

                  type EnableGzip

                  type EnableGzip struct{}

                    EnableGzip 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 (*EnableGzip) HandleFinalize

                    func (*EnableGzip) HandleFinalize(
                    	ctx context.Context, input middleware.FinalizeInput, next middleware.FinalizeHandler,
                    ) (
                    	output middleware.FinalizeOutput, metadata middleware.Metadata, err error,
                    )

                      HandleFinalize implements the FinalizeMiddleware interface.

                      func (*EnableGzip) ID

                      func (*EnableGzip) ID() string

                        ID returns the id for the middleware.