Socket
Socket
Sign inDemoInstall

@smithy/protocol-http

Package Overview
Dependencies
Maintainers
2
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/protocol-http - npm Package Compare versions

Comparing version 4.0.3 to 4.0.4

38

dist-cjs/index.js

@@ -27,2 +27,3 @@ var __defProp = Object.defineProperty;

HttpResponse: () => HttpResponse,
IHttpRequest: () => import_types.HttpRequest,
getHttpHandlerExtensionConfiguration: () => getHttpHandlerExtensionConfiguration,

@@ -160,2 +161,3 @@ isValidHostname: () => isValidHostname,

// src/httpRequest.ts
var _HttpRequest = class _HttpRequest {

@@ -175,16 +177,36 @@ constructor(options) {

}
/**
* Note: this does not deep-clone the body.
*/
static clone(request) {
const cloned = new _HttpRequest({
...request,
headers: { ...request.headers }
});
if (cloned.query) {
cloned.query = cloneQuery(cloned.query);
}
return cloned;
}
/**
* This method only actually asserts that request is the interface {@link IHttpRequest},
* and not necessarily this concrete class. Left in place for API stability.
*
* Do not call instance methods on the input of this function, and
* do not assume it has the HttpRequest prototype.
*/
static isInstance(request) {
if (!request)
if (!request) {
return false;
}
const req = request;
return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object";
}
/**
* @deprecated use static HttpRequest.clone(request) instead. It's not safe to call
* this method because {@link HttpRequest.isInstance} incorrectly
* asserts that IHttpRequest (interface) objects are of type HttpRequest (class).
*/
clone() {
const cloned = new _HttpRequest({
...this,
headers: { ...this.headers }
});
if (cloned.query)
cloned.query = cloneQuery(cloned.query);
return cloned;
return _HttpRequest.clone(this);
}

@@ -191,0 +213,0 @@ };

@@ -19,5 +19,16 @@ export class HttpRequest {

}
static clone(request) {
const cloned = new HttpRequest({
...request,
headers: { ...request.headers },
});
if (cloned.query) {
cloned.query = cloneQuery(cloned.query);
}
return cloned;
}
static isInstance(request) {
if (!request)
if (!request) {
return false;
}
const req = request;

@@ -32,9 +43,3 @@ return ("method" in req &&

clone() {
const cloned = new HttpRequest({
...this,
headers: { ...this.headers },
});
if (cloned.query)
cloned.query = cloneQuery(cloned.query);
return cloned;
return HttpRequest.clone(this);
}

@@ -41,0 +46,0 @@ }

@@ -5,4 +5,19 @@ import { HeaderBag, HttpMessage, HttpRequest as IHttpRequest, QueryParameterBag, URI } from "@smithy/types";

};
/**
* Use the distinct IHttpRequest interface from @smithy/types instead.
* This should not be used due to
* overlapping with the concrete class' name.
*
* This is not marked deprecated since that would mark the concrete class
* deprecated as well.
*/
export interface HttpRequest extends IHttpRequest {
}
/**
* @public
*/
export { IHttpRequest };
/**
* @public
*/
export declare class HttpRequest implements HttpMessage, URI {

@@ -21,5 +36,20 @@ method: string;

constructor(options: HttpRequestOptions);
/**
* Note: this does not deep-clone the body.
*/
static clone(request: IHttpRequest): HttpRequest;
/**
* This method only actually asserts that request is the interface {@link IHttpRequest},
* and not necessarily this concrete class. Left in place for API stability.
*
* Do not call instance methods on the input of this function, and
* do not assume it has the HttpRequest prototype.
*/
static isInstance(request: unknown): request is HttpRequest;
/**
* @deprecated use static HttpRequest.clone(request) instead. It's not safe to call
* this method because {@link HttpRequest.isInstance} incorrectly
* asserts that IHttpRequest (interface) objects are of type HttpRequest (class).
*/
clone(): HttpRequest;
}
export {};

@@ -5,4 +5,19 @@ import { HeaderBag, HttpMessage, HttpRequest as IHttpRequest, QueryParameterBag, URI } from "@smithy/types";

};
/**
* Use the distinct IHttpRequest interface from @smithy/types instead.
* This should not be used due to
* overlapping with the concrete class' name.
*
* This is not marked deprecated since that would mark the concrete class
* deprecated as well.
*/
export interface HttpRequest extends IHttpRequest {
}
/**
* @public
*/
export { IHttpRequest };
/**
* @public
*/
export declare class HttpRequest implements HttpMessage, URI {

@@ -21,5 +36,20 @@ method: string;

constructor(options: HttpRequestOptions);
/**
* Note: this does not deep-clone the body.
*/
static clone(request: IHttpRequest): HttpRequest;
/**
* This method only actually asserts that request is the interface {@link IHttpRequest},
* and not necessarily this concrete class. Left in place for API stability.
*
* Do not call instance methods on the input of this function, and
* do not assume it has the HttpRequest prototype.
*/
static isInstance(request: unknown): request is HttpRequest;
/**
* @deprecated use static HttpRequest.clone(request) instead. It's not safe to call
* this method because {@link HttpRequest.isInstance} incorrectly
* asserts that IHttpRequest (interface) objects are of type HttpRequest (class).
*/
clone(): HttpRequest;
}
export {};
{
"name": "@smithy/protocol-http",
"version": "4.0.3",
"version": "4.0.4",
"scripts": {

@@ -5,0 +5,0 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc