lib/fhir_client/client.rb
def request_payload(resource, headers)
      if headers
        format_specified = headers['Content-Type']
        if format_specified.nil?
          resource.to_xml
        elsif format_specified.downcase.include?('xml')
          resource.to_xml
        elsif format_specified.downcase.include?('json')
          resource.to_json
        else
          resource.to_xml
        end
      else
        resource.to_xml
      end
    end
def request_payload(resource, headers)
      if headers
        format_specified = headers['Content-Type']
        if format_specified.nil?
          resource.to_xml
        elsif format_specified.downcase.include?('xml')
          resource.to_xml
        elsif format_specified.downcase.include?('json')
          resource.to_json
        else
          resource.to_xml
        end
      else
        resource.to_xml
      end
    end
Extract the request payload in the specified format, defaults to XML