@smithy/protocol-http
Advanced tools
Comparing version 1.0.1 to 1.1.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Field = void 0; | ||
const types_1 = require("./types"); | ||
const types_1 = require("@smithy/types"); | ||
class Field { | ||
@@ -6,0 +6,0 @@ constructor({ name, kind = types_1.FieldPosition.HEADER, values = [] }) { |
@@ -18,2 +18,5 @@ "use strict"; | ||
this.path = options.path ? (options.path.charAt(0) !== "/" ? `/${options.path}` : options.path) : "/"; | ||
this.username = options.username; | ||
this.password = options.password; | ||
this.fragment = options.fragment; | ||
} | ||
@@ -20,0 +23,0 @@ static isInstance(request) { |
@@ -7,2 +7,3 @@ "use strict"; | ||
this.statusCode = options.statusCode; | ||
this.reason = options.reason; | ||
this.headers = options.headers || {}; | ||
@@ -9,0 +10,0 @@ this.body = options.body; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FieldPosition = void 0; | ||
var FieldPosition; | ||
(function (FieldPosition) { | ||
FieldPosition[FieldPosition["HEADER"] = 0] = "HEADER"; | ||
FieldPosition[FieldPosition["TRAILER"] = 1] = "TRAILER"; | ||
})(FieldPosition = exports.FieldPosition || (exports.FieldPosition = {})); |
@@ -1,2 +0,2 @@ | ||
import { FieldPosition } from "./types"; | ||
import { FieldPosition } from "@smithy/types"; | ||
export class Field { | ||
@@ -3,0 +3,0 @@ constructor({ name, kind = FieldPosition.HEADER, values = [] }) { |
@@ -15,2 +15,5 @@ export class HttpRequest { | ||
this.path = options.path ? (options.path.charAt(0) !== "/" ? `/${options.path}` : options.path) : "/"; | ||
this.username = options.username; | ||
this.password = options.password; | ||
this.fragment = options.fragment; | ||
} | ||
@@ -17,0 +20,0 @@ static isInstance(request) { |
export class HttpResponse { | ||
constructor(options) { | ||
this.statusCode = options.statusCode; | ||
this.reason = options.reason; | ||
this.headers = options.headers || {}; | ||
@@ -5,0 +6,0 @@ this.body = options.body; |
@@ -1,5 +0,1 @@ | ||
export var FieldPosition; | ||
(function (FieldPosition) { | ||
FieldPosition[FieldPosition["HEADER"] = 0] = "HEADER"; | ||
FieldPosition[FieldPosition["TRAILER"] = 1] = "TRAILER"; | ||
})(FieldPosition || (FieldPosition = {})); | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import { FieldOptions, FieldPosition } from "./types"; | ||
import { FieldOptions, FieldPosition } from "@smithy/types"; | ||
/** | ||
@@ -3,0 +3,0 @@ * A name-value pair representing a single field |
@@ -0,3 +1,3 @@ | ||
import { FieldPosition } from "@smithy/types"; | ||
import { Field } from "./Field"; | ||
import { FieldPosition } from "./types"; | ||
export type FieldsOptions = { | ||
@@ -4,0 +4,0 @@ fields?: Field[]; |
@@ -1,5 +0,4 @@ | ||
import { RequestHandler } from "@smithy/types"; | ||
import { HttpHandlerOptions, RequestHandler } from "@smithy/types"; | ||
import { HttpRequest } from "./httpRequest"; | ||
import { HttpResponse } from "./httpResponse"; | ||
import { HttpHandlerOptions } from "./types"; | ||
export type HttpHandler = RequestHandler<HttpRequest, HttpResponse, HttpHandlerOptions>; |
@@ -1,16 +0,8 @@ | ||
import { Endpoint, QueryParameterBag } from "@smithy/types"; | ||
import { HeaderBag, HttpMessage } from "./types"; | ||
type HttpRequestOptions = Partial<HttpMessage> & Partial<Endpoint> & { | ||
import { HeaderBag, HttpMessage, HttpRequest as IHttpRequest, QueryParameterBag, URI } from "@smithy/types"; | ||
type HttpRequestOptions = Partial<HttpMessage> & Partial<URI> & { | ||
method?: string; | ||
}; | ||
/** | ||
* @public | ||
* | ||
* Interface an HTTP request class. Contains | ||
* addressing information in addition to standard message properties. | ||
*/ | ||
export interface HttpRequest extends HttpMessage, Endpoint { | ||
method: string; | ||
export interface HttpRequest extends IHttpRequest { | ||
} | ||
export declare class HttpRequest implements HttpMessage, Endpoint { | ||
export declare class HttpRequest implements HttpMessage, URI { | ||
method: string; | ||
@@ -23,2 +15,5 @@ protocol: string; | ||
headers: HeaderBag; | ||
username?: string; | ||
password?: string; | ||
fragment?: string; | ||
body?: any; | ||
@@ -25,0 +20,0 @@ constructor(options: HttpRequestOptions); |
@@ -1,16 +0,11 @@ | ||
import { HeaderBag, HttpMessage } from "./types"; | ||
import { HeaderBag, HttpMessage, HttpResponse as IHttpResponse } from "@smithy/types"; | ||
type HttpResponseOptions = Partial<HttpMessage> & { | ||
statusCode: number; | ||
reason?: string; | ||
}; | ||
/** | ||
* @public | ||
* | ||
* Represents an HTTP message as received in reply to a request. Contains a | ||
* numeric status code in addition to standard message properties. | ||
*/ | ||
export interface HttpResponse extends HttpMessage { | ||
statusCode: number; | ||
export interface HttpResponse extends IHttpResponse { | ||
} | ||
export declare class HttpResponse { | ||
statusCode: number; | ||
reason?: string; | ||
headers: HeaderBag; | ||
@@ -17,0 +12,0 @@ body?: any; |
@@ -1,56 +0,21 @@ | ||
import { AbortSignal } from "@smithy/types"; | ||
export type FieldOptions = { | ||
name: string; | ||
kind?: FieldPosition; | ||
values?: string[]; | ||
}; | ||
export declare enum FieldPosition { | ||
HEADER = 0, | ||
TRAILER = 1 | ||
} | ||
import { FieldOptions as __FieldOptions, FieldPosition as __FieldPosition, HeaderBag as __HeaderBag, HttpHandlerOptions as __HttpHandlerOptions, HttpMessage as __HttpMessage } from "@smithy/types"; | ||
/** | ||
* @public | ||
* | ||
* A mapping of header names to string values. Multiple values for the same | ||
* header should be represented as a single string with values separated by | ||
* `, `. | ||
* | ||
* Keys should be considered case insensitive, even if this is not enforced by a | ||
* particular implementation. For example, given the following HeaderBag, where | ||
* keys differ only in case: | ||
* | ||
* ```json | ||
* { | ||
* 'x-request-date': '2000-01-01T00:00:00Z', | ||
* 'X-Request-Date': '2001-01-01T00:00:00Z' | ||
* } | ||
* ``` | ||
* | ||
* The SDK may at any point during processing remove one of the object | ||
* properties in favor of the other. The headers may or may not be combined, and | ||
* the SDK will not deterministically select which header candidate to use. | ||
* @deprecated Use FieldOptions from `@smithy/types` instead | ||
*/ | ||
export type HeaderBag = Record<string, string>; | ||
export type FieldOptions = __FieldOptions; | ||
/** | ||
* @public | ||
* | ||
* Represents an HTTP message with headers and an optional static or streaming | ||
* body. bode: ArrayBuffer | ArrayBufferView | string | Uint8Array | Readable | ReadableStream; | ||
* @deprecated Use FieldPosition from `@smithy/types` instead | ||
*/ | ||
export interface HttpMessage { | ||
headers: HeaderBag; | ||
body?: any; | ||
} | ||
export type FieldPosition = __FieldPosition; | ||
/** | ||
* @public | ||
* | ||
* Represents the options that may be passed to an Http Handler. | ||
* @deprecated Use HeaderBag from `@smithy/types` instead | ||
*/ | ||
export interface HttpHandlerOptions { | ||
abortSignal?: AbortSignal; | ||
/** | ||
* The maximum time in milliseconds that the connection phase of a request | ||
* may take before the connection attempt is abandoned. | ||
*/ | ||
requestTimeout?: number; | ||
} | ||
export type HeaderBag = __HeaderBag; | ||
/** | ||
* @deprecated Use HttpMessage from `@smithy/types` instead | ||
*/ | ||
export type HttpMessage = __HttpMessage; | ||
/** | ||
* @deprecated Use HttpHandlerOptions from `@smithy/types` instead | ||
*/ | ||
export type HttpHandlerOptions = __HttpHandlerOptions; |
{ | ||
"name": "@smithy/protocol-http", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"scripts": { | ||
@@ -26,3 +26,3 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", | ||
"dependencies": { | ||
"@smithy/types": "^1.0.0", | ||
"@smithy/types": "^1.1.0", | ||
"tslib": "^2.5.0" | ||
@@ -53,2 +53,3 @@ }, | ||
"downlevel-dts": "0.10.1", | ||
"jest": "28.1.1", | ||
"rimraf": "3.0.2", | ||
@@ -55,0 +56,0 @@ "typedoc": "0.23.23", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26734
7
424
Updated@smithy/types@^1.1.0