Skip to content

Commit

Permalink
feat: remove unused functions (#936)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chase Coalwell committed Feb 18, 2020
1 parent 65e0ce0 commit b81bd3e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 39 deletions.
1 change: 0 additions & 1 deletion packages/protocol-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"license": "Apache-2.0",
"dependencies": {
"@aws-sdk/types": "^1.0.0-alpha.4",
"@aws-sdk/util-uri-escape": "^1.0.0-alpha.2",
"tslib": "^1.8.0"
},
"devDependencies": {
Expand Down
38 changes: 0 additions & 38 deletions packages/protocol-http/src/httpRequest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { escapeUri } from "@aws-sdk/util-uri-escape";
import {
HttpMessage,
Endpoint,
Expand Down Expand Up @@ -55,18 +54,6 @@ export class HttpRequest implements HttpMessage, Endpoint {
);
}

getFormatedUrl(): string {
let hostname = this.hostname;
if (this.port) {
hostname += `:${this.port}`;
}
let queryString = this.query ? buildQueryString(this.query) : "";
if (queryString && queryString[0] !== "?") {
queryString = `?${queryString}`;
}
return `${this.protocol}//${hostname}${this.path}${queryString}`;
}

clone(): HttpRequest {
const cloned = new HttpRequest({
...this,
Expand All @@ -89,28 +76,3 @@ function cloneQuery(query: QueryParameterBag): QueryParameterBag {
{}
);
}

function buildQueryString(query: QueryParameterBag): string {
const queryEntries = Object.entries(query || ({} as QueryParameterBag))
.map(([key, value]): [string, string | Array<string> | null] => [
escapeUri(key),
value
])
.map(([key, value]) => {
if (Array.isArray(value)) {
return value.map(val => `${key}=${escapeUri(val)}`);
} else {
let qsEntry = key;
if (value || typeof value === "string") {
qsEntry += `=${escapeUri(value)}`;
}
return [qsEntry];
}
})
.reduce((accummulator, entry) => {
accummulator.push(...entry);
return accummulator;
}, [] as Array<String>);

return queryEntries.join("&");
}

0 comments on commit b81bd3e

Please sign in to comment.