lib/ezid/requests/request.rb in ezid-client-0.12.0 vs lib/ezid/requests/request.rb in ezid-client-0.13.0

- old
+ new

@@ -13,13 +13,10 @@ # @abstract # class Request < SimpleDelegator extend Forwardable - CHARSET = "UTF-8" - CONTENT_TYPE = "text/plain" - # HTTP methods GET = Net::HTTP::Get PUT = Net::HTTP::Put POST = Net::HTTP::Post DELETE = Net::HTTP::Delete @@ -43,10 +40,11 @@ # @param client [Ezid::Client] the client def initialize(client, *args) @client = client super build_request + customize_request end # Executes the request and returns the response # @return [Ezid::Response] the response def execute @@ -91,14 +89,17 @@ private def get_response_for_request connection.start do |conn| - set_content_type(CONTENT_TYPE, charset: CHARSET) add_authentication if authentication_required? add_metadata if has_metadata? conn.request(__getobj__) end + end + + def customize_request + set_content_type("text/plain", charset: "UTF-8") end def build_request self.class.http_method.new(uri) end