Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using json-bigint instead of native JSON to fix long integer id's. #154

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ strava.defaultRequest = request.defaults({
baseUrl: 'https://www.strava.com/api/v3/',
headers: {
'User-Agent': 'node-strava-v3 v' + version
},
json: true
}
})

strava.client = function (token, request) {
Expand Down
3 changes: 2 additions & 1 deletion lib/httpClient.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint camelcase: 0 */
const JSONbig = require('json-bigint')
const Promise = require('bluebird')
const querystring = require('querystring')
const fs = require('fs')
Expand Down Expand Up @@ -187,7 +188,7 @@ HttpClient.prototype._requestHelper = function (options, done) {
// as an extra arg in the callback
// The newer promise-bsed API updates a global rateLimiting counter
limits = rateLimiting.updateRateLimits(response.headers)
return Promise.resolve(response.body)
return Promise.resolve(JSONbig.parse(response.body))
})
.catch((e) => {
if (e.response && e.response.headers) {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"dependencies": {
"bluebird": "^3.5.0",
"request": "^2.81.0",
"request-promise": "^4.2.0"
"request-promise": "^4.2.0",
"json-bigint": "^1.0.0"
},
"devDependencies": {
"env-restorer": "^1.0.0",
Expand Down