Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

[AutoPR automation/resource-manager] Reverting the schedule.json response code for Created to 201 as that … #3075

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, scheduleName,
return callback(err);
}
let statusCode = response.statusCode;
if (statusCode !== 200 && statusCode !== 409) {
if (statusCode !== 200 && statusCode !== 201 && statusCode !== 409) {
let error = new Error(responseBody);
error.statusCode = response.statusCode;
error.request = msRest.stripRequest(httpRequest);
Expand Down Expand Up @@ -225,6 +225,23 @@ function _createOrUpdate(resourceGroupName, automationAccountName, scheduleName,
return callback(deserializationError);
}
}
// Deserialize Response
if (statusCode === 201) {
let parsedResponse = null;
try {
parsedResponse = JSON.parse(responseBody);
result = JSON.parse(responseBody);
if (parsedResponse !== null && parsedResponse !== undefined) {
let resultMapper = new client.models['Schedule']().mapper();
result = client.deserialize(resultMapper, parsedResponse, 'result');
}
} catch (error) {
let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
deserializationError1.request = msRest.stripRequest(httpRequest);
deserializationError1.response = msRest.stripResponse(response);
return callback(deserializationError1);
}
}

return callback(null, result, httpRequest, response);
});
Expand Down