Permalink
Browse files

644: Returning error for invalid status codes

  • Loading branch information...
1 parent 932a0b8 commit fd31a005f05c7f743f035c37253289ee90cca94f Andre Rodrigues committed Mar 15, 2013
Showing with 1,468 additions and 1,382 deletions.
  1. +1 −1 examples/servicemanagement/testaddcertificate.js
  2. +1 −1 examples/servicemanagement/testadddatadiskbyblob.js
  3. +1 −1 examples/servicemanagement/testadddatadiskbyname.js
  4. +1 −1 examples/servicemanagement/testadddatadiskempty.js
  5. +1 −1 examples/servicemanagement/testadddiskinrepos.js
  6. +1 −1 examples/servicemanagement/testaddrole.js
  7. +1 −1 examples/servicemanagement/testcapturerole.js
  8. +1 −1 examples/servicemanagement/testcreatedeployment.js
  9. +1 −1 examples/servicemanagement/testcreatehostedservice.js
  10. +1 −1 examples/servicemanagement/testcreateosimage.js
  11. +1 −1 examples/servicemanagement/testdeletecertificate.js
  12. +1 −1 examples/servicemanagement/testdeletedeployment.js
  13. +1 −1 examples/servicemanagement/testdeletedisk.js
  14. +1 −1 examples/servicemanagement/testdeletehostedservice.js
  15. +1 −1 examples/servicemanagement/testdeleteosimage.js
  16. +1 −1 examples/servicemanagement/testdeleterole.js
  17. +1 −1 examples/servicemanagement/testlistcertificates.js
  18. +1 −1 examples/servicemanagement/testmodifydatadisk.js
  19. +1 −1 examples/servicemanagement/testmodifyrole.js
  20. +1 −1 examples/servicemanagement/testremovedatadisk.js
  21. +3 −3 examples/servicemanagement/testshutdownrestart.js
  22. +6 −6 lib/http/webresource.js
  23. +14 −14 lib/services/blob/blobservice.js
  24. +19 −2 lib/services/core/serviceclient.js
  25. +6 −6 lib/services/queue/queueservice.js
  26. +11 −11 lib/services/serviceBus/servicebusservice.js
  27. +1 −1 lib/services/serviceBus/servicebusservicebase.js
  28. +1 −1 lib/services/serviceBus/wrapservice.js
  29. +1 −1 lib/services/serviceManagement/servicebusmanagementservice.js
  30. +25 −25 lib/services/serviceManagement/servicemanagementservice.js
  31. +6 −6 lib/services/serviceManagement/sqlmanagementservice.js
  32. +1 −1 lib/services/table/batchserviceclient.js
  33. +5 −5 lib/services/table/tableservice.js
  34. +12 −11 lib/util/constants.js
  35. +43 −29 test/recordings/apnsservice-tests.nock.js
  36. +119 −77 test/recordings/notificationhubservice-tests.nock.js
  37. +968 −968 test/recordings/servicebusservice-tests.nock.js
  38. +113 −121 test/recordings/wnsservice-tests.nock.js
  39. +3 −3 test/recordings/wrapservice-tests.nock.js
  40. +4 −4 test/recordings/wraptokenmanager-tests.nock.js
  41. +3 −3 test/services/blob/blobservice-longrunning-tests.js
  42. +5 −5 test/services/blob/blobservice-tests.js
  43. +1 −1 test/services/blob/sharedkeylite-tests.js
  44. +17 −17 test/services/queue/queueservice-tests.js
  45. +22 −2 test/services/serviceBus/notificationhubs-tests.js
  46. +2 −2 test/services/table/batchserviceclient-tests.js
  47. +1 −1 test/services/table/queryentitiesresultcontinuation-tests.js
  48. +2 −2 test/services/table/sharedkeytable-tests.js
  49. +34 −34 test/services/table/tableservice-tests.js
@@ -47,7 +47,7 @@ svcmgmt.addCertificate(inputNames.serviceName,
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -60,7 +60,7 @@ svcmgmt.addDataDisk(inputNames.serviceName,
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -61,7 +61,7 @@ svcmgmt.addDataDisk(inputNames.serviceName,
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -60,7 +60,7 @@ svcmgmt.addDataDisk(inputNames.serviceName,
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -40,7 +40,7 @@ svcmgmt.addDisk(diskName, mediaLink, function(error, response) {
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -93,7 +93,7 @@ svcmgmt.addRole(inputNames.serviceName,
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -62,7 +62,7 @@ svcmgmt.captureRoleInstance(inputNames.serviceName,
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -131,7 +131,7 @@ svcmgmt.createDeployment(svcname,
console.log(response);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -40,7 +40,7 @@ svcmgmt.createHostedService(svcname, svcopt, function(error, response) {
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -41,7 +41,7 @@ svcmgmt.createOSImage(typeOS, imgName, mediaLink, function(error, response) {
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -45,7 +45,7 @@ svcmgmt.deleteCertificate(inputNames.serviceName,
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -43,7 +43,7 @@ svcmgmt.deleteDeployment(inputNames.serviceName, inputNames.deploymentName, func
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -39,7 +39,7 @@ svcmgmt.deleteDisk(diskName, function(error, response) {
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -42,7 +42,7 @@ svcmgmt.deleteHostedService(inputNames.serviceName, function(error, response) {
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -42,7 +42,7 @@ svcmgmt.deleteOSImage(inputNames.imageName, function(error, response) {
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -44,7 +44,7 @@ svcmgmt.deleteRole(inputNames.serviceName, inputNames.deploymentName, inputNames
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -41,7 +41,7 @@ svcmgmt.listCertificates(inputNames.serviceName, function(error, response) {
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -56,7 +56,7 @@ svcmgmt.modifyDataDisk(inputNames.serviceName,
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -59,7 +59,7 @@ svcmgmt.modifyRole(inputNames.serviceName,
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -49,7 +49,7 @@ svcmgmt.removeDataDisk(inputNames.serviceName,
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -57,7 +57,7 @@ if (reqid.toLowerCase() == 'shutdown') {
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -77,7 +77,7 @@ if (reqid.toLowerCase() == 'shutdown') {
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
@@ -97,7 +97,7 @@ if (reqid.toLowerCase() == 'shutdown') {
testCommon.showErrorResponse(error);
} else {
if (response && response.isSuccessful) {
- if (response.statusCode == HttpResponseCodes.OK_CODE) {
+ if (response.statusCode == HttpResponseCodes.Ok) {
console.log('OK');
} else {
console.log('Pending');
View
@@ -45,7 +45,7 @@ WebResource.put = function (path) {
var webResource = new WebResource();
webResource.path = path ? encodeSpecialCharacters(path) : null;
webResource.httpVerb = HttpConstants.HttpVerbs.PUT;
- webResource.okCodes = [HttpConstants.HttpResponseCodes.CREATED_CODE];
+ webResource.okCodes = [HttpConstants.HttpResponseCodes.Created];
return webResource;
};
@@ -59,7 +59,7 @@ WebResource.get = function (path) {
var webResource = new WebResource();
webResource.path = path ? encodeSpecialCharacters(path) : null;
webResource.httpVerb = HttpConstants.HttpVerbs.GET;
- webResource.okCodes = [HttpConstants.HttpResponseCodes.OK_CODE];
+ webResource.okCodes = [HttpConstants.HttpResponseCodes.Ok];
return webResource;
};
@@ -73,7 +73,7 @@ WebResource.head = function (path) {
var webResource = new WebResource();
webResource.path = path ? encodeSpecialCharacters(path) : null;
webResource.httpVerb = HttpConstants.HttpVerbs.HEAD;
- webResource.okCodes = [HttpConstants.HttpResponseCodes.OK_CODE];
+ webResource.okCodes = [HttpConstants.HttpResponseCodes.Ok];
return webResource;
};
@@ -87,7 +87,7 @@ WebResource.del = function (path) {
var webResource = new WebResource();
webResource.path = path ? encodeSpecialCharacters(path) : null;
webResource.httpVerb = HttpConstants.HttpVerbs.DELETE;
- webResource.okCodes = [HttpConstants.HttpResponseCodes.NO_CONTENT_CODE];
+ webResource.okCodes = [HttpConstants.HttpResponseCodes.NoContent];
return webResource;
};
@@ -101,7 +101,7 @@ WebResource.post = function (path) {
var webResource = new WebResource();
webResource.path = path ? encodeSpecialCharacters(path) : null;
webResource.httpVerb = HttpConstants.HttpVerbs.POST;
- webResource.okCodes = [HttpConstants.HttpResponseCodes.CREATED_CODE];
+ webResource.okCodes = [HttpConstants.HttpResponseCodes.Created];
return webResource;
};
@@ -115,7 +115,7 @@ WebResource.merge = function (path) {
var webResource = new WebResource();
webResource.path = path ? encodeSpecialCharacters(path) : null;
webResource.httpVerb = HttpConstants.HttpVerbs.MERGE;
- webResource.okCodes = [HttpConstants.HttpResponseCodes.CREATED_CODE];
+ webResource.okCodes = [HttpConstants.HttpResponseCodes.Created];
return webResource;
};
@@ -243,7 +243,7 @@ BlobService.prototype.setServiceProperties = function (serviceProperties, option
var servicePropertiesXml = servicePropertiesResult.serialize(serviceProperties);
- var webResource = WebResource.put().withOkCode(HttpConstants.HttpResponseCodes.ACCEPTED_CODE);
+ var webResource = WebResource.put().withOkCode(HttpConstants.HttpResponseCodes.Accepted);
webResource.addOptionalQueryParam(QueryStringConstants.COMP, 'properties');
webResource.addOptionalQueryParam(QueryStringConstants.RESTYPE, 'service');
@@ -535,7 +535,7 @@ BlobService.prototype.setContainerMetadata = function (container, metadata, opti
validateCallback(callback);
var webResource = WebResource.put(container)
- .withOkCode(HttpConstants.HttpResponseCodes.OK_CODE)
+ .withOkCode(HttpConstants.HttpResponseCodes.Ok)
.withProperty(BlobConstants.ResourceTypeProperty, BlobConstants.ResourceTypes.CONTAINER)
.withProperty(BlobConstants.SharedAccessPermissionProperty, BlobConstants.SharedAccessPermissions.WRITE);
@@ -624,7 +624,7 @@ BlobService.prototype.setContainerAcl = function (container, publicAccessLevel,
validateCallback(callback);
var webResource = WebResource.put(container)
- .withOkCode(HttpConstants.HttpResponseCodes.OK_CODE)
+ .withOkCode(HttpConstants.HttpResponseCodes.Ok)
.withProperty(BlobConstants.ResourceTypeProperty, BlobConstants.ResourceTypes.CONTAINER)
.withProperty(BlobConstants.SharedAccessPermissionProperty, BlobConstants.SharedAccessPermissions.WRITE);
@@ -682,7 +682,7 @@ BlobService.prototype.deleteContainer = function (container, optionsOrCallback,
validateCallback(callback);
var webResource = WebResource.del(container)
- .withOkCode(HttpConstants.HttpResponseCodes.ACCEPTED_CODE)
+ .withOkCode(HttpConstants.HttpResponseCodes.Accepted)
.withProperty(BlobConstants.ResourceTypeProperty, BlobConstants.ResourceTypes.CONTAINER)
.withProperty(BlobConstants.SharedAccessPermissionProperty, BlobConstants.SharedAccessPermissions.WRITE);
@@ -1142,7 +1142,7 @@ BlobService.prototype.getBlobMetadata = function (container, blob, optionsOrCall
var resourceName = createResourceName(container, blob);
var webResource = WebResource.head(resourceName)
- .withOkCode(HttpConstants.HttpResponseCodes.OK_CODE)
+ .withOkCode(HttpConstants.HttpResponseCodes.Ok)
.withProperty(BlobConstants.ResourceTypeProperty, BlobConstants.ResourceTypes.BLOB)
.withProperty(BlobConstants.SharedAccessPermissionProperty, BlobConstants.SharedAccessPermissions.READ);
@@ -1204,7 +1204,7 @@ BlobService.prototype.setBlobProperties = function (container, blob, optionsOrCa
validateCallback(callback);
var resourceName = createResourceName(container, blob);
- var webResource = WebResource.put(resourceName).withOkCode(HttpConstants.HttpResponseCodes.OK_CODE)
+ var webResource = WebResource.put(resourceName).withOkCode(HttpConstants.HttpResponseCodes.Ok)
.withProperty(BlobConstants.ResourceTypeProperty, BlobConstants.ResourceTypes.BLOB)
.withProperty(BlobConstants.SharedAccessPermissionProperty, BlobConstants.SharedAccessPermissions.WRITE);
@@ -1258,7 +1258,7 @@ BlobService.prototype.setBlobMetadata = function (container, blob, metadata, opt
var resourceName = createResourceName(container, blob);
var webResource = WebResource.put(resourceName)
- .withOkCode(HttpConstants.HttpResponseCodes.OK_CODE)
+ .withOkCode(HttpConstants.HttpResponseCodes.Ok)
.withProperty(BlobConstants.ResourceTypeProperty, BlobConstants.ResourceTypes.BLOB)
.withProperty(BlobConstants.SharedAccessPermissionProperty, BlobConstants.SharedAccessPermissions.WRITE);
@@ -1403,7 +1403,7 @@ BlobService.prototype.getBlobToStream = function (container, blob, writeStream,
var resourceName = createResourceName(container, blob);
var webResource = WebResource.get(resourceName)
- .withOkCode(HttpConstants.HttpResponseCodes.PARTIAL_CONTENT, true)
+ .withOkCode(HttpConstants.HttpResponseCodes.PartialContent, true)
.withProperty(BlobConstants.ResourceTypeProperty, BlobConstants.ResourceTypes.BLOB)
.withProperty(BlobConstants.SharedAccessPermissionProperty, BlobConstants.SharedAccessPermissions.READ)
.withRawResponse();
@@ -1478,7 +1478,7 @@ BlobService.prototype.getBlobToText = function (container, blob, optionsOrCallba
var resourceName = createResourceName(container, blob);
var webResource = WebResource.get(resourceName)
- .withOkCode(HttpConstants.HttpResponseCodes.PARTIAL_CONTENT, true)
+ .withOkCode(HttpConstants.HttpResponseCodes.PartialContent, true)
.withProperty(BlobConstants.ResourceTypeProperty, BlobConstants.ResourceTypes.BLOB)
.withProperty(BlobConstants.SharedAccessPermissionProperty, BlobConstants.SharedAccessPermissions.READ)
.withRawResponse();
@@ -1538,7 +1538,7 @@ BlobService.prototype.deleteBlob = function (container, blob, optionsOrCallback,
var resourceName = createResourceName(container, blob);
var webResource = WebResource.del(resourceName)
- .withOkCode(HttpConstants.HttpResponseCodes.ACCEPTED_CODE)
+ .withOkCode(HttpConstants.HttpResponseCodes.Accepted)
.withProperty(BlobConstants.ResourceTypeProperty, BlobConstants.ResourceTypes.BLOB)
.withProperty(BlobConstants.SharedAccessPermissionProperty, BlobConstants.SharedAccessPermissions.WRITE);
@@ -2341,19 +2341,19 @@ BlobService.prototype._leaseBlobImpl = function (container, blob, leaseId, lease
switch (leaseAction) {
case BlobConstants.LeaseOperation.ACQUIRE:
// Acquire: A successful operation returns status code 201 (Created).
- expectedResponseCode = HttpConstants.HttpResponseCodes.CREATED_CODE;
+ expectedResponseCode = HttpConstants.HttpResponseCodes.Created;
break;
case BlobConstants.LeaseOperation.RENEW:
// Renew: A successful operation returns status code 200 (OK).
- expectedResponseCode = HttpConstants.HttpResponseCodes.OK_CODE;
+ expectedResponseCode = HttpConstants.HttpResponseCodes.Ok;
break;
case BlobConstants.LeaseOperation.RELEASE:
// Release: A successful operation returns status code 200 (OK).
- expectedResponseCode = HttpConstants.HttpResponseCodes.OK_CODE;
+ expectedResponseCode = HttpConstants.HttpResponseCodes.Ok;
break;
case BlobConstants.LeaseOperation.BREAK:
// Break: A successful operation returns status code 202 (Accepted).
- expectedResponseCode = HttpConstants.HttpResponseCodes.ACCEPTED_CODE;
+ expectedResponseCode = HttpConstants.HttpResponseCodes.Accepted;
break;
}
Oops, something went wrong.

0 comments on commit fd31a00

Please sign in to comment.