Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 11 commits
  • 5 files changed
  • 0 commit comments
  • 5 contributors
Commits on Aug 07, 2012
@smarx smarx fix entity group transactions with delete commands: don't send a cont…
…ent-type header for these
513f0cf
Commits on Aug 14, 2012
@andrerod Merge pull request #300 from smarx/dev
fix entity group transactions with delete commands: don't send a content-type header for thse
d3fd9ed
@andrerod Merge pull request #313 from andrerod/dev
Bugfixing
edf3a49
Commits on Aug 15, 2012
@christav christav Making errors instance of Error() 8e0b4de
Commits on Aug 16, 2012
@christav christav Updates for coding style e03ebd5
@christav christav Merge pull request #317 from christav/fixing_error
Making errors instance of Error()
3a03486
Commits on Aug 19, 2012
@pofallon pofallon For stream output, invoke callback on response 503487b
Commits on Aug 20, 2012
@andrerod Merge pull request #320 from pofallon/dev
In case of inputStream, invoke callback on response event
ebf952e
Commits on Sep 07, 2012
@andrerod #325: need to change dependency to keep xml2js 0.1.x or update code t…
…o deal with 0.2.x.
08b8cfe
@andrerod Changing dependency. 017ae65
Commits on Sep 12, 2012
@andrerod Merge remote-tracking branch 'upstream/dev' into dev 3114f23
View
25 lib/services/core/serviceclient.js
@@ -180,33 +180,38 @@ ServiceClient.prototype._performRequest = function (webResource, body, options,
self.logger.log(Logger.LogLevels.DEBUG, "FINAL REQUEST OPTIONS:\n" + util.inspect(finalRequestOptions));
var processResponseCallback = function (error, response, responseBody) {
+
var responseObject;
if (error) {
responseObject = { error: error, response: null };
} else {
- if (!(body && body.inputStream)) {
- response.body = responseBody;
- }
-
responseObject = self._processResponse(webResource, response);
}
operationCallback(responseObject, next);
};
var requestStream;
- if (body && body.outputStream) {
- requestStream = request(finalRequestOptions, processResponseCallback);
- body.outputStream.pipe(requestStream);
- } else {
+
+ if (!(body && body.outputStream)) {
finalRequestOptions.body = body.outputData;
- requestStream = request(finalRequestOptions, processResponseCallback);
}
if (body && body.inputStream) {
+ requestStream = request(finalRequestOptions);
+ requestStream.on('response', function(response) {
+ processResponseCallback(null, response);
+ });
requestStream.pipe(body.inputStream);
+ } else {
+ requestStream = request(finalRequestOptions, processResponseCallback);
+ }
+
+ if (body && body.outputStream) {
+ body.outputStream.pipe(requestStream);
}
+
};
// The filter will do what it needs to the requestOptions and will provide a
@@ -559,7 +564,7 @@ ServiceClient.isEmulated = function (host) {
* @return {Object} The normalized error object with all properties lower cased.
*/
ServiceClient.prototype._normalizeError = function (error) {
- var normalizedError = {};
+ var normalizedError = new Error();
for (var property in error) {
if (property !== '@') {
if (error[property] && error[property]['#']) {
View
6 lib/services/table/batchserviceclient.js
@@ -96,11 +96,13 @@ BatchServiceClient.prototype.addOperation = function (webResource, outputData) {
outputData = '';
}
- if (webResource.httpVerb !== ServiceClient.HTTP_VERB_GET) {
+ if (webResource.httpVerb !== 'GET') {
webResource.headers[HeaderConstants.CONTENT_ID] = this.operations.length + 1;
- if (webResource.httpVerb !== ServiceClient.HTTP_VERB_DELETE) {
+ if (webResource.httpVerb !== 'DELETE') {
webResource.headers[HeaderConstants.CONTENT_TYPE] = 'application/atom+xml;type=entry';
+ } else {
+ delete webResource.headers[HeaderConstants.CONTENT_TYPE];
}
webResource.headers[HeaderConstants.CONTENT_LENGTH] = outputData.length;
View
2 package.json
@@ -9,7 +9,7 @@
"engines": { "node": ">= 0.6.15" },
"licenses": [ { "type": "Apache", "url": "http://www.apache.org/licenses/LICENSE-2.0" } ],
"dependencies": {
- "xml2js" : ">= 0.1.11",
+ "xml2js" : "0.1.x",
"sax": ">= 0.1.1",
"qs": ">= 0.3.1",
"log": ">= 1.2.0",
View
35 test/services/core/serviceclient-tests.js
@@ -0,0 +1,35 @@
+/**
+* Copyright (c) Microsoft. All rights reserved.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+var should = require('should');
+var testutil = require('../../util/util');
+var azure = testutil.libRequire('azure');
+var ServiceClient = azure.ServiceClient;
+
+suite('serviceclient-tests', function () {
+ test('NormalizedErrorsAreErrors', function () {
+ var error = {
+ 'message': 'this is an error message',
+ 'ResultCode': 500,
+ 'somethingElse': 'goes here'
+ };
+
+ var normalizedError = ServiceClient.prototype._normalizeError(error);
+
+ normalizedError.should.be.an.instanceOf(Error);
+ normalizedError.should.have.keys('message', 'resultcode', 'somethingelse');
+ });
+});
+
View
1 test/testlist.txt
@@ -7,6 +7,7 @@ services/blob/sharedaccesssignature-tests.js
services/blob/sharedkey-tests.js
services/blob/sharedkeylite-tests.js
services/blob/filters-tests.js
+services/core/serviceclient-tests.js
services/core/exponentialretrypolicyfilter-tests.js
services/core/linearretrypolicyfilter-tests.js
services/queue/queueservice-tests.js

No commit comments for this range

Something went wrong with that request. Please try again.