Skip to content

Commit

Permalink
Merge pull request #16 from bhushankumarl/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Bhushankumar Lilapara authored Feb 16, 2018
2 parents 92e78ab + 24e7c9e commit 9944010
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.0.15
- Bug fixed ResponseMetadata (RequestId) in success response
- Added throttling details in non-xml response

0.0.14
- Clean code
- Added typeScript example of reports
Expand All @@ -11,7 +15,6 @@
- Add support upto NODE 8
- Added ListOrderItems example of Orders


0.0.13 December 08, 2017
- Add the MWS Version Detail
- Additional error & exception handling
Expand Down
19 changes: 16 additions & 3 deletions lib/AmazonMwsResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,15 @@ AmazonMwsResource.prototype = {
})
.on('end', function () {
debug('response after parsing tab delimited file %o ', data);
return callback(null, data);
response = {};
response.data = data;
response.Headers = {
'x-mws-quota-max': res.headers['x-mws-quota-max'] || 'unknown',
'x-mws-quota-remaining': res.headers['x-mws-quota-remaining'] || 'unknown',
'x-mws-quota-resetson': res.headers['x-mws-quota-resetson'] || 'unknown',
'x-mws-timestamp': res.headers['x-mws-timestamp']
};
return callback(null, response);
});
}
}
Expand Down Expand Up @@ -214,9 +222,12 @@ AmazonMwsResource.prototype = {

var ResponseMetadata = {};
var Headers = {};
//debug('res.headers[content-type]', res.headers['content-type']);
debug('res.headers[content-type]', res.headers['content-type']);
if (RESPONSE_CONTENT_TYPE.indexOf(res.headers['content-type'].toLowerCase()) > -1) {
//debug('response.headers', response.headers);
/*
* It should execute for only XML response
*/
// debug('response.headers', response.headers);
debug('response Before Process %o ', JSON.stringify(response));
Headers = response.Headers;
if (response[requestParamsJSONCopy.Action + 'Response']) {
Expand All @@ -229,10 +240,12 @@ AmazonMwsResource.prototype = {
debug('exception', exception);
ResponseMetadata = {};
}
// debug('ResponseMetadata %o ', ResponseMetadata);
if (response[requestParamsJSONCopy.Action + 'Result']) {
response = response[requestParamsJSONCopy.Action + 'Result'];
}

response.ResponseMetadata = ResponseMetadata;
response.Headers = Headers;
debug('response before %o ', JSON.stringify(response));
processXml(response, 'update');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amazon-mws",
"version": "0.0.14",
"version": "0.0.15",
"description": "Amazon MWS API wrapper",
"keywords": [
"Amazon MWS",
Expand Down

0 comments on commit 9944010

Please sign in to comment.