diff --git a/src/cli/one_helper/oneflow_helper.rb b/src/cli/one_helper/oneflow_helper.rb index 82ef24dc62..a9605a952f 100644 --- a/src/cli/one_helper/oneflow_helper.rb +++ b/src/cli/one_helper/oneflow_helper.rb @@ -28,12 +28,14 @@ class OneFlowHelper < OpenNebulaHelper::OneHelper # # @options [Hash] CLI options def client(options) - Service::Client.new( + flow_client = Service::Client.new( :username => options[:username], :password => options[:password], :url => options[:server], :user_agent => USER_AGENT ) + flow_client.set_content_type('application/json') + flow_client end # Get service pool table diff --git a/src/cli/one_helper/oneflowtemplate_helper.rb b/src/cli/one_helper/oneflowtemplate_helper.rb index fe5dc73940..2b6b18e6ad 100644 --- a/src/cli/one_helper/oneflowtemplate_helper.rb +++ b/src/cli/one_helper/oneflowtemplate_helper.rb @@ -28,12 +28,14 @@ class OneFlowTemplateHelper < OpenNebulaHelper::OneHelper # # @options [Hash] CLI options def client(options) - Service::Client.new( + flow_template_client = Service::Client.new( :username => options[:username], :password => options[:password], :url => options[:server], :user_agent => USER_AGENT ) + flow_template_client.set_content_type('application/json') + flow_template_client end # Get service template pool diff --git a/src/oca/ruby/opennebula/oneflow_client.rb b/src/oca/ruby/opennebula/oneflow_client.rb index 947c754041..8f1ba69a84 100644 --- a/src/oca/ruby/opennebula/oneflow_client.rb +++ b/src/oca/ruby/opennebula/oneflow_client.rb @@ -429,7 +429,7 @@ module Service req = Net::HTTP::Proxy(@host, @port)::Post.new(path) req.body = body - if path.start_with?('/service_template') && !@content_type.nil? + unless @content_type.nil? req.content_type = @content_type end do_request(req)