require 'diesel/middleware/set_parameter_base'

module Diesel
  module Middleware
    class SetBodyParameter < SetParameterBase
      def apply_parameter_value(env, value)
        if value
          env[:body] = if body = env[:body]
            body.merge(value)
          else
            value
          end
        end
      end
    end
  end
end

require 'diesel/middleware/set_parameter_base'

module Diesel
  module Middleware
    class SetBodyParameter < SetParameterBase
      def apply_parameter_value(env, value)
        if value
          env[:body] = if body = env[:body]
            body.merge(value)
          else
            value
          end
          if env[:request_headers]["Content-Type"].nil?
            env[:request_headers]["Content-Type"] = "application/json"
          end
        end
      end
    end
  end
end

Set content type if there is a body parameter
Set content type if there is a body parameter
