Skip to content

Commit

Permalink
fix: update valory version
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrconley committed Mar 25, 2020
1 parent e4b84a0 commit 7672f25
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 29 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "valory-adaptor-alb",
"version": "0.0.0",
"version": "2.0.0-beta.1",
"main": "dist/albAdaptor.js",
"typings": "dist/albAdaptor.d.ts",
"license": "MIT",
Expand All @@ -14,10 +14,10 @@
"semantic-release": "^16.0.4",
"tslint": "^6.1.0",
"typescript": "^3.8.3",
"valory-runtime": "^4.0.0-v4.2"
"valory-runtime": "^4.0.0-v4.5"
},
"peerDependencies": {
"valory-runtime": "^4.0.0-v4.2"
"valory-runtime": "^4.0.0-v4.5"
},
"dependencies": {
"find-my-way": "^2.2.2"
Expand Down
22 changes: 0 additions & 22 deletions src/albAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,11 @@ export class ALBAdaptor implements ApiAdaptor {
public register(path: string, method: HttpMethod, handler: (ctx: ApiContext) => Promise<ApiContext>) {
this.router.on(method, path.replace(pathReplacer, ":$1"), async (request, callback, params) => {
const content = (request.isBase64Encoded) ? Buffer.from("base64").toString() : request.body;
const parsed = attemptParse(request.headers["content-type"], content);
const tranRequest = new ApiContext({
headers: request.headers,
queryParams: request.queryStringParameters,
pathParams: params,
body: parsed,
rawBody: content,
formData: parsed,
method,
path
});
Expand Down Expand Up @@ -75,22 +72,3 @@ export class ALBAdaptor implements ApiAdaptor {
this.router.lookup(formatted, cb);
}
}

function attemptParse(contentType: string, obj: any): any {
if (contentType == null) {
return obj;
}
const parsedContentType = contentType.split(";")[0];
try {
switch (parsedContentType) {
case "application/json":
return JSON.parse(obj);
case "application/x-www-form-urlencoded":
return qs.parse(obj);
default:
return obj;
}
} catch (err) {
return obj;
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5658,10 +5658,10 @@ validate-npm-package-name@^3.0.0, validate-npm-package-name@~3.0.0:
dependencies:
builtins "^1.0.3"

valory-runtime@^4.0.0-v4.2:
version "4.0.0-v4.2"
resolved "https://registry.yarnpkg.com/valory-runtime/-/valory-runtime-4.0.0-v4.2.tgz#506bcc24ccbd2db56435baf03d8ae8f5d83216df"
integrity sha512-RGIzhwcXQGYQ2XXKHyUKAw7syLEIxEb1XpZqjk2u0iez5Hw2IbWYKdaDn5TWxV5h/DFpLJ1KVTdinJeHIWJY3w==
valory-runtime@^4.0.0-v4.5:
version "4.0.0-v4.5"
resolved "https://registry.yarnpkg.com/valory-runtime/-/valory-runtime-4.0.0-v4.5.tgz#e2d4ff55daaf540b57116f26350c6748b0275c6b"
integrity sha512-tqUJVbuYnTm0VcYtIoCf/eeNU8uKT9nl9YFB8KrR9bjIdBlWpeA1YYMGdeQARpMUAR60ahlmslMud4ibSavUHg==
dependencies:
"@types/pino" "^5.20.0"
openapi-types "^1.3.5"
Expand Down

0 comments on commit 7672f25

Please sign in to comment.