@aws-sdk/protocol-http
Advanced tools
Comparing version 3.186.0 to 3.188.0
@@ -6,2 +6,10 @@ # Change Log | ||
# [3.188.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.187.0...v3.188.0) (2022-10-13) | ||
**Note:** Version bump only for package @aws-sdk/protocol-http | ||
# [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06) | ||
@@ -8,0 +16,0 @@ |
@@ -1,4 +0,3 @@ | ||
import { __assign, __read, __spreadArray } from "tslib"; | ||
var HttpRequest = (function () { | ||
function HttpRequest(options) { | ||
export class HttpRequest { | ||
constructor(options) { | ||
this.method = options.method || "GET"; | ||
@@ -12,11 +11,11 @@ this.hostname = options.hostname || "localhost"; | ||
? options.protocol.slice(-1) !== ":" | ||
? "".concat(options.protocol, ":") | ||
? `${options.protocol}:` | ||
: options.protocol | ||
: "https:"; | ||
this.path = options.path ? (options.path.charAt(0) !== "/" ? "/".concat(options.path) : options.path) : "/"; | ||
this.path = options.path ? (options.path.charAt(0) !== "/" ? `/${options.path}` : options.path) : "/"; | ||
} | ||
HttpRequest.isInstance = function (request) { | ||
static isInstance(request) { | ||
if (!request) | ||
return false; | ||
var req = request; | ||
const req = request; | ||
return ("method" in req && | ||
@@ -28,18 +27,21 @@ "protocol" in req && | ||
typeof req["headers"] === "object"); | ||
}; | ||
HttpRequest.prototype.clone = function () { | ||
var cloned = new HttpRequest(__assign(__assign({}, this), { headers: __assign({}, this.headers) })); | ||
} | ||
clone() { | ||
const cloned = new HttpRequest({ | ||
...this, | ||
headers: { ...this.headers }, | ||
}); | ||
if (cloned.query) | ||
cloned.query = cloneQuery(cloned.query); | ||
return cloned; | ||
}; | ||
return HttpRequest; | ||
}()); | ||
export { HttpRequest }; | ||
} | ||
} | ||
function cloneQuery(query) { | ||
return Object.keys(query).reduce(function (carry, paramName) { | ||
var _a; | ||
var param = query[paramName]; | ||
return __assign(__assign({}, carry), (_a = {}, _a[paramName] = Array.isArray(param) ? __spreadArray([], __read(param), false) : param, _a)); | ||
return Object.keys(query).reduce((carry, paramName) => { | ||
const param = query[paramName]; | ||
return { | ||
...carry, | ||
[paramName]: Array.isArray(param) ? [...param] : param, | ||
}; | ||
}, {}); | ||
} |
@@ -1,3 +0,3 @@ | ||
var HttpResponse = (function () { | ||
function HttpResponse(options) { | ||
export class HttpResponse { | ||
constructor(options) { | ||
this.statusCode = options.statusCode; | ||
@@ -7,10 +7,8 @@ this.headers = options.headers || {}; | ||
} | ||
HttpResponse.isInstance = function (response) { | ||
static isInstance(response) { | ||
if (!response) | ||
return false; | ||
var resp = response; | ||
const resp = response; | ||
return typeof resp.statusCode === "number" && typeof resp.headers === "object"; | ||
}; | ||
return HttpResponse; | ||
}()); | ||
export { HttpResponse }; | ||
} | ||
} |
export function isValidHostname(hostname) { | ||
var hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/; | ||
const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/; | ||
return hostPattern.test(hostname); | ||
} |
{ | ||
"name": "@aws-sdk/protocol-http", | ||
"version": "3.186.0", | ||
"version": "3.188.0", | ||
"scripts": { | ||
@@ -24,3 +24,3 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", | ||
"dependencies": { | ||
"@aws-sdk/types": "3.186.0", | ||
"@aws-sdk/types": "3.188.0", | ||
"tslib": "^2.3.1" | ||
@@ -27,0 +27,0 @@ }, |
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
59439
+ Added@aws-sdk/types@3.188.0(transitive)
- Removed@aws-sdk/types@3.186.0(transitive)
Updated@aws-sdk/types@3.188.0