Commits

Sean Cribbs committed 50ca10d

Fix header return format and query string bugs.

  • Participants
  • Parent commits 574bb92

Comments (0)

Files changed (1)

riak-client/lib/riak/client/excon_backend.rb

       def perform(method, uri, headers, expect, data=nil, &block)
         params = {:headers => RequestHeaders.new(headers)}
         params[:body] = data if [:put,:post].include?(method)
+        # Excon currently doesn't properly handle string query
+        # segment. Why?
+        if uri.query
+          q = uri.query.split('&').map {|kv| kv.split('=') }
+          uri.query = nil
+          params[:query] = {}
+          q.each do |pair|
+            params[:query][pair[0]] ||= []
+            params[:query][pair[0]] << pair[1]
+          end
+        end
         # params[:idempotent] = (method != :post)
         response = Excon.send(method, uri.to_s, params, &block)
         if valid_response?(expect, response.status)
-          result = {:headers => response_headers.initialize_http_header(response.headers), :code => response.status}
+          response_headers.initialize_http_header(response.headers)
+          result = {:headers => response_headers.to_hash, :code => response.status}
           if return_body?(method, response.status, block_given?)
             result[:body] = response.body
           end