Skip to content

Commit

Permalink
Merge pull request #217 from algorand/release/v1.7.2
Browse files Browse the repository at this point in the history
Release/v1.7.2
  • Loading branch information
algorotem authored Sep 25, 2020
2 parents dc857c3 + c012397 commit 6f3d3a7
Show file tree
Hide file tree
Showing 10 changed files with 227 additions and 400 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 1.7.2
## Fixed
- Fixed msgpack endpoints returning undefined in browsers (#210 and #215).
- Removed use of class properties (#213).
## Changed
- Remove unneeded dependency js-yaml and changed mock-http-server to a dev dependency (#214 and #212).
# 1.7.1
## Fixed
- Fixed set Accept on GET calls
Expand Down
2 changes: 1 addition & 1 deletion dist/algosdk.min.js

Large diffs are not rendered by default.

389 changes: 100 additions & 289 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "algosdk",
"version": "1.7.1",
"version": "1.7.2",
"description": "algosdk is Algorand's official javascript SDK",
"main": "index.js",
"directories": {
Expand All @@ -15,15 +15,12 @@
"hi-base32": "^0.5.0",
"js-sha256": "^0.9.0",
"js-sha512": "^0.8.0",
"js-yaml": ">=3.13.1",
"keccak256": "^1.0.0",
"mock-http-server": "^1.4.2",
"superagent": "^4.1.0",
"tweetnacl": "^1.0.1"
},
"devDependencies": {
"@babel/core": "^7.6.0",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/preset-env": "^7.6.0",
"babel-core": "^6.26.3",
"babel-minify": "^0.5.1",
Expand All @@ -34,6 +31,7 @@
"cucumber": "^5.1.0",
"mocha": "^5.2.0",
"mocha-lcov-reporter": "^1.3.0",
"mock-http-server": "^1.4.2",
"uglify-js": "^3.6.0",
"watchify": "^3.11.1",
"xmlhttprequest": "^1.8.0"
Expand All @@ -44,7 +42,7 @@
],
"scripts": {
"test": "mocha -R spec tests/",
"build": "browserify --transform [babelify --plugins [ @babel/plugin-proposal-class-properties ] ] src/main.js -s algosdk | minify --simplify --mangle.keepClassName --deadcode.keepFnArgs --comments false --outFile dist/algosdk.min.js"
"build": "browserify src/main.js -s algosdk | minify --simplify --mangle.keepClassName --deadcode.keepFnArgs --comments false --outFile dist/algosdk.min.js"
},
"author": "Algorand, llc",
"license": "MIT"
Expand Down
11 changes: 9 additions & 2 deletions src/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,20 @@ function HTTPClient(token, baseServer, port, headers={}) {

this.get = async function (path, query, requestHeaders={}) {
try {
return await request
const format = getAccceptFormat(query);
let r = request
.get(this.address + path)
.set(this.token)
.set(this.defaultHeaders)
.set(requestHeaders)
.set('Accept', getAccceptFormat(query))
.set('Accept', format)
.query(removeEmpty(query));

if (format === 'application/msgpack') {
r = r.responseType('arraybuffer');
}

return await r;
} catch (e) {
throw e;
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/v2/algod/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Block {
*/
async do(headers={}) {
let res = await this.c.get("/v2/blocks/" + this.round, this.query, headers);
if (res.body) {
if (res.body && res.body.byteLength > 0) {
return encoding.decode(res.body);
}
return undefined;
Expand Down
Loading

0 comments on commit 6f3d3a7

Please sign in to comment.