File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " manticoresearch" ,
3
- "version" : " 3.2 .0" ,
3
+ "version" : " 3.1 .0" ,
4
4
"description" : " Javascript client for Manticore Search" ,
5
5
"license" : " MIT" ,
6
6
"main" : " src/index.js" ,
18
18
" index"
19
19
],
20
20
"dependencies" : {
21
- "superagent" : " 5.1.0"
21
+ "superagent" : " 5.1.0" ,
22
+ "json-bigint" : " 1.0.0"
22
23
},
23
24
"devDependencies" : {
24
25
"inherits" : " ^2.0.4" ,
Original file line number Diff line number Diff line change 24
24
25
25
/**
26
26
* @module ApiClient
27
- * @version 3.2 .0
27
+ * @version 3.0 .0
28
28
*/
29
29
30
30
/**
335
335
} ) ;
336
336
} ;
337
337
338
+ exports . JSONbig = require ( 'json-bigint' ) ( { storeAsString : true } ) ;
339
+
338
340
/**
339
341
* Deserializes an HTTP response body into a value of the specified type.
340
342
* @param {Object } response A SuperAgent response object.
348
350
if ( response == null || returnType == null || response . status == 204 ) {
349
351
return null ;
350
352
}
351
- // Rely on SuperAgent for parsing response body.
353
+ // Use json-bigint for parsing json responses otherwise rely on SuperAgent
352
354
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
353
- var data = response . body ;
355
+ var data ;
356
+ if ( returnType === Object || typeof returnType === 'object' ) {
357
+ data = exports . JSONbig . parse ( response . text ) ;
358
+ } else {
359
+ data = response . body ;
360
+ }
354
361
if ( data == null || ( typeof data === 'object' && typeof data . length === 'undefined' && ! Object . keys ( data ) . length ) ) {
355
362
// SuperAgent does not always produce a body; use the unparsed response as a fallback
356
363
data = response . text ;
357
364
}
358
- return exports . convertToType ( data , returnType ) ;
365
+ const res = exports . convertToType ( data , returnType ) ;
366
+ return res ;
359
367
} ;
360
368
361
369
/**
440
448
}
441
449
442
450
if ( contentType === 'application/x-www-form-urlencoded' ) {
443
- request . send ( querystring . stringify ( this . normalizeParams ( formParams ) ) ) ;
451
+ console . log ( 'test request 2' ) ;
452
+ request . send ( querystring . stringify ( this . normalizeParams ( formParams ) ) ) ;
444
453
} else if ( contentType == 'multipart/form-data' ) {
445
454
var _formParams = this . normalizeParams ( formParams ) ;
446
455
for ( var key in _formParams ) {
You can’t perform that action at this time.
0 commit comments