diff --git a/lib/woocommerce_api.rb b/lib/woocommerce_api.rb index 4ef29b2..5ee832b 100644 --- a/lib/woocommerce_api.rb +++ b/lib/woocommerce_api.rb @@ -132,11 +132,12 @@ def do_request method, endpoint, data = {} options = options.merge(@httparty_args) # Set headers. - options[:headers] = { + default_headers = { "User-Agent" => "WooCommerce API Client-Ruby/#{WooCommerce::VERSION}", "Accept" => "application/json" } - options[:headers]["Content-Type"] = "application/json;charset=utf-8" if !data.empty? + options[:headers] = default_headers.merge(options[:headers] || {}) + options[:headers]["Content-Type"] ||= "application/json;charset=utf-8" if !data.empty? # Set basic authentication. if @is_ssl