[Groonga-commit] ranguba/groonga-client at c5166fa [master] http thread: support JSON body with 500 response

Back to archive index

Kouhei Sutou null+****@clear*****
Mon May 12 15:07:04 JST 2014


Kouhei Sutou	2014-05-12 15:07:04 +0900 (Mon, 12 May 2014)

  New Revision: c5166fab955666a33d292f36e38b02eb5b01a11c
  https://github.com/ranguba/groonga-client/commit/c5166fab955666a33d292f36e38b02eb5b01a11c

  Message:
    http thread: support JSON body with 500 response

  Modified files:
    lib/groonga/client/protocol/http/thread.rb

  Modified: lib/groonga/client/protocol/http/thread.rb (+7 -3)
===================================================================
--- lib/groonga/client/protocol/http/thread.rb    2014-05-08 16:19:15 +0900 (326dae3)
+++ lib/groonga/client/protocol/http/thread.rb    2014-05-12 15:07:04 +0900 (ba1578c)
@@ -51,9 +51,13 @@ module Groonga
                   when Net::HTTPSuccess, Net::HTTPBadRequest
                     yield(response.body)
                   else
-                    message =
-                      "#{response.code} #{response.message}: #{response.body}"
-                    raise Error.new(message)
+                    if response.body.start_with?("[[")
+                      yield(response.body)
+                    else
+                      message =
+                        "#{response.code} #{response.message}: #{response.body}"
+                      raise Error.new(message)
+                    end
                   end
                 end
               rescue SystemCallError, Timeout::Error
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index