Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http method get with status code 204 should be success in long-running operation #1056

Merged
merged 1 commit into from
May 18, 2016
Merged
Show file tree
Hide file tree
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 @@ -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