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 11{
22 "name" : " manticoresearch" ,
3- "version" : " 3.2 .0" ,
3+ "version" : " 3.1 .0" ,
44 "description" : " Javascript client for Manticore Search" ,
55 "license" : " MIT" ,
66 "main" : " src/index.js" ,
1818 " index"
1919 ],
2020 "dependencies" : {
21- "superagent" : " 5.1.0"
21+ "superagent" : " 5.1.0" ,
22+ "json-bigint" : " 1.0.0"
2223 },
2324 "devDependencies" : {
2425 "inherits" : " ^2.0.4" ,
Original file line number Diff line number Diff line change 2424
2525 /**
2626 * @module ApiClient
27- * @version 3.2 .0
27+ * @version 3.0 .0
2828 */
2929
3030 /**
335335 } ) ;
336336 } ;
337337
338+ exports . JSONbig = require ( 'json-bigint' ) ( { storeAsString : true } ) ;
339+
338340 /**
339341 * Deserializes an HTTP response body into a value of the specified type.
340342 * @param {Object } response A SuperAgent response object.
348350 if ( response == null || returnType == null || response . status == 204 ) {
349351 return null ;
350352 }
351- // Rely on SuperAgent for parsing response body.
353+ // Use json-bigint for parsing json responses otherwise rely on SuperAgent
352354 // 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+ }
354361 if ( data == null || ( typeof data === 'object' && typeof data . length === 'undefined' && ! Object . keys ( data ) . length ) ) {
355362 // SuperAgent does not always produce a body; use the unparsed response as a fallback
356363 data = response . text ;
357364 }
358- return exports . convertToType ( data , returnType ) ;
365+ const res = exports . convertToType ( data , returnType ) ;
366+ return res ;
359367 } ;
360368
361369 /**
440448 }
441449
442450 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 ) ) ) ;
444453 } else if ( contentType == 'multipart/form-data' ) {
445454 var _formParams = this . normalizeParams ( formParams ) ;
446455 for ( var key in _formParams ) {
You can’t perform that action at this time.
0 commit comments