Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

removing xml2json support since it don\'t work correct

  • Loading branch information...
commit b5bdc0771cbeb96578e04f89c395a1922e8d60f2 1 parent 5f3255f
@frozzare authored
Showing with 2 additions and 11 deletions.
  1. +0 −2  README.md
  2. +2 −9 lib/pinboard.js
View
2  README.md
@@ -20,8 +20,6 @@ then you need to auth yourself so you are good to go with the API
format: 'json' // or 'xml', default is 'json'.
});
-the default format for `node-pinboard` is json. but 'xml' is default on Pinboard API, so for thoose method that don't have the format support we get the xml and parse it into json if you have json format on that method request.
-
all Pinboard methods is paste into the `pinboard.get` function, e.g.
pinboard.get( method, [options,] callback );
View
11 lib/pinboard.js
@@ -1,5 +1,4 @@
var request = require('request'),
- parser = require('xml2json'),
pinboard = {
/*
@@ -11,8 +10,6 @@ var request = require('request'),
this.format = options.format || 'json';
},
- parseJSON: false,
-
/*
* Object with all the pinboard methods
*/
@@ -263,9 +260,7 @@ var request = require('request'),
* and then when request are done it call the pinboard callback
*/
- request: function (method, options, callback, xml) {
- if (xml) this.parseJSON = options.format === 'json';
-
+ request: function (method, options, callback) {
request({
url: pinboard.url + "/" + method + pinboard.formatArguments(options)
}, function (error, response, body) {
@@ -304,9 +299,7 @@ var request = require('request'),
if (item.err) {
throw item.err;
} else if (item.res.statusCode == 200) {
- var data = this.parseJSON ? parser.toJson(item.body, {
- object: true
- }) : item.format === 'json' ? eval('(' + item.body + ')') : item.body;
+ var data = item.format === 'json' ? eval('(' + item.body + ')') : item.body;
item.callback.call(this, data);
this.parseJSON = false;
Please sign in to comment.
Something went wrong with that request. Please try again.