lib/amazon.js
function parseMwsResponse(method, headers, response, callback) {
  // if it's XML, then we an parse correctly
  if (headers && headers['content-type'] == 'text/xml') {
    xml2js.parseString(response, {explicitArray: false}, function(err, result) {
      if (err) {
        return callback(err);
      }

      if (result.ErrorResponse) {
        err = {
          Code: 'Unknown',
          Message: 'Unknown MWS error'
        };

        if (result.ErrorResponse.Error) {
          err = result.ErrorResponse.Error;
        }

        return callback(error.apiError(err.Code, err.Message, result));
      } else {
        callback(null, new Response(method, result));
      }
    });
  } else {
    callback(null, new Response(method, { "Response": response }));
  }
}
function parseMwsResponse(method, headers, response, callback) {
  // if it's XML, then we an parse correctly
  if (headers && headers['content-type'] == 'text/xml') {
    xml2js.parseString(response, {explicitArray: false}, function(err, result) {
      if (err) {
        return callback(err);
      }

      if (result.ErrorResponse) {
        err = {
          Code: 'Unknown',
          Message: 'Unknown MWS error'
        };

        if (result.ErrorResponse.Error) {
          err = result.ErrorResponse.Error;
        }

        return callback(error.apiError(err.Code, err.Message, result));
      } else {
        callback(null, new Response(method, result));
      }
    });
  } else {
    callback(null, new Response(method, { "Response": response }));
  }
}
function parseMwsResponse ( method , headers , response , callback ) { // if it's XML, then we an parse correctly if ( headers && headers [ 'content-type' ] == 'text/xml' ) { xml2js . parseString ( response , { explicitArray : false } , function ( err , result ) { if ( err ) { return callback ( err ) ; } if ( result . ErrorResponse ) { err = { Code : 'Unknown' , Message : 'Unknown MWS error' } ; if ( result . ErrorResponse . Error ) { err = result . ErrorResponse . Error ; } return callback ( error . apiError ( err . Code , err . Message , result ) ) ; } else { callback ( null , new Response ( method , result ) ) ; } } ) ; } else { callback ( null , new Response ( method , { "Response" : response } ) ) ; } }
Parse the MWS response.

@param {string} method
@param {Object[]} headers
@param {string} response
@param {function} callback
Parse the MWS response .