Skip to content

Commit

Permalink
Http method get with status code 204 should be success in longrunning…
Browse files Browse the repository at this point in the history
… operation. (Azure#1056)
  • Loading branch information
vishrutshah committed May 18, 2016
1 parent 35e197f commit adee9ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_long_running_operation_result(azure_response, custom_deserialization_blo
elsif !polling_state.location_header_link.nil?
update_state_from_location_header(polling_state.get_request(headers: request.headers, base_uri: request.base_uri), polling_state, custom_deserialization_block)
elsif http_method === :put
get_request = MsRest::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, 'get', query_params: request.query_params)
get_request = MsRest::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, :get, query_params: request.query_params)
update_state_from_get_resource_operation(get_request, polling_state, custom_deserialization_block)
else
task.shutdown
Expand Down Expand Up @@ -64,7 +64,7 @@ def get_long_running_operation_result(azure_response, custom_deserialization_blo
end

if (http_method === :put || http_method === :patch) && AsyncOperationStatus.is_successful_status(polling_state.status) && polling_state.resource.nil?
get_request = MsRest::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, 'get', query_params: request.query_params)
get_request = MsRest::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, :get, query_params: request.query_params)
update_state_from_get_resource_operation(get_request, polling_state, custom_deserialization_block)
end

Expand Down Expand Up @@ -154,7 +154,7 @@ def update_state_from_location_header(request, polling_state, custom_deserializa
if status_code === 202
polling_state.status = AsyncOperationStatus::IN_PROGRESS_STATUS
elsif status_code === 200 || (status_code === 201 && http_method === :put) ||
(status_code === 204 && (http_method === :delete || http_method === :post))
(status_code === 204 && (http_method === :delete || http_method === :post || http_method === :get))
polling_state.status = AsyncOperationStatus::SUCCESS_STATUS

error_data = CloudErrorData.new
Expand All @@ -164,7 +164,7 @@ def update_state_from_location_header(request, polling_state, custom_deserializa
polling_state.error_data = error_data
polling_state.resource = result.body
else
fail AzureOperationError, 'The response from long running operation does not have a valid status code'
fail AzureOperationError, "The response from long running operation does not have a valid status code. Method: #{http_method}, Status Code: #{status_code}"
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def get_operation_error

def get_request(options = {})
link = @azure_async_operation_header_link || @location_header_link
MsRest::HttpOperationRequest.new(nil, link, 'get', options)
MsRest::HttpOperationRequest.new(nil, link, :get, options)
end

private
Expand Down

0 comments on commit adee9ea

Please sign in to comment.