@aws-sdk/protocol-http

  • Version 3.342.0
  • Published
  • 28.5 kB
  • 2 dependencies
  • Apache-2.0 license

Install

npm i @aws-sdk/protocol-http
yarn add @aws-sdk/protocol-http
pnpm add @aws-sdk/protocol-http

Overview

[![NPM version](https://img.shields.io/npm/v/@aws-sdk/protocol-http/latest.svg)](https://www.npmjs.com/package/@aws-sdk/protocol-http) [![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/protocol-http.svg)](https://www.npmjs.com/package/@aws-sdk/prot

Index

Functions

function isValidHostname

isValidHostname: (hostname: string) => boolean;

    Classes

    class Field

    class Field {}
    • A name-value pair representing a single field transmitted in an HTTP Request or Response.

      The kind will dictate metadata placement within an HTTP message.

      All field names are case insensitive and case-variance must be treated as equivalent. Names MAY be normalized but SHOULD be preserved for accuracy during transmission.

    constructor

    constructor({ name, kind, values }: FieldOptions);

      property kind

      readonly kind: FieldPosition;

        property name

        readonly name: string;

          property values

          values: string[];

            method add

            add: (value: string) => void;
            • Appends a value to the field.

              Parameter value

              The value to append.

            method get

            get: () => string[];
            • Get string values as a list

              Returns

              Values in Field as a list.

            method remove

            remove: (value: string) => void;
            • Remove all matching entries from list.

              Parameter value

              Value to remove.

            method set

            set: (values: string[]) => void;
            • Overwrite existing field values.

              Parameter values

              The new field values.

            method toString

            toString: () => string;
            • Get comma-delimited string.

              Returns

              String representation of Field.

            class Fields

            class Fields {}
            • Collection of Field entries mapped by name.

            constructor

            constructor({ fields, encoding }: FieldsOptions);

              method getByType

              getByType: (kind: FieldPosition) => Field[];
              • Helper function for retrieving specific types of fields. Used to grab all headers or all trailers.

                Parameter kind

                FieldPosition of entries to retrieve.

                Returns

                The Field entries with the specified FieldPosition.

              method getField

              getField: (name: string) => Field | undefined;
              • Retrieve Field entry by name.

                Parameter name

                The name of the Field entry to retrieve

                Returns

                The Field if it exists.

              method removeField

              removeField: (name: string) => void;
              • Delete entry from collection.

                Parameter name

                Name of the entry to delete.

              method setField

              setField: (field: Field) => void;
              • Set entry for a Field name. The name attribute will be used to key the collection.

                Parameter field

                The Field to set.

              class HttpRequest

              class HttpRequest implements HttpMessage, Endpoint {}

                constructor

                constructor(options: any);

                  property body

                  body?: any;

                    property headers

                    headers: HeaderBag;

                      property hostname

                      hostname: string;

                        property method

                        method: string;

                          property path

                          path: string;

                            property port

                            port?: number;

                              property protocol

                              protocol: string;

                                property query

                                query: QueryParameterBag;

                                  method clone

                                  clone: () => HttpRequest;

                                    method isInstance

                                    static isInstance: (request: unknown) => request is HttpRequest;

                                      class HttpResponse

                                      class HttpResponse {}

                                        constructor

                                        constructor(options: any);

                                          property body

                                          body?: any;

                                            property headers

                                            headers: HeaderBag;

                                              property statusCode

                                              statusCode: number;

                                                method isInstance

                                                static isInstance: (response: unknown) => response is HttpResponse;

                                                  Interfaces

                                                  interface HttpRequest

                                                  interface HttpRequest extends IHttpRequest {}

                                                    interface HttpResponse

                                                    interface HttpResponse extends IHttpResponse {}

                                                      Enums

                                                      enum FieldPosition

                                                      enum FieldPosition {
                                                      HEADER = 0,
                                                      TRAILER = 1,
                                                      }

                                                        member HEADER

                                                        HEADER = 0

                                                          member TRAILER

                                                          TRAILER = 1

                                                            Type Aliases

                                                            type FieldOptions

                                                            type FieldOptions = {
                                                            name: string;
                                                            kind?: FieldPosition;
                                                            values?: string[];
                                                            };

                                                              type FieldsOptions

                                                              type FieldsOptions = {
                                                              fields?: Field[];
                                                              encoding?: string;
                                                              };

                                                                type HttpHandler

                                                                type HttpHandler = RequestHandler<HttpRequest, HttpResponse, HttpHandlerOptions>;

                                                                  Package Files (8)

                                                                  Dependencies (2)

                                                                  Dev Dependencies (6)

                                                                  Peer Dependencies (0)

                                                                  No peer dependencies.

                                                                  Badge

                                                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@aws-sdk/protocol-http.

                                                                  • Markdown
                                                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@aws-sdk/protocol-http)
                                                                  • HTML
                                                                    <a href="https://www.jsdocs.io/package/@aws-sdk/protocol-http"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>