Skip to content

Commit 776b66a

Browse files
committed
Doesn't enforce UTF-8 encoding in Response object if the string is frozen.
Elasticsearch responses are UTF-8 encoded. Cloning the string instead could be very expensive. Fixes #63
1 parent 85eb09a commit 776b66a

File tree

1 file changed

+1
-1
lines changed
  • elasticsearch-transport/lib/elasticsearch/transport/transport

1 file changed

+1
-1
lines changed

elasticsearch-transport/lib/elasticsearch/transport/transport/response.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Response
2828
# @param headers [Hash] Response headers
2929
def initialize(status, body, headers={})
3030
@status, @body, @headers = status, body, headers
31-
@body = body.force_encoding('UTF-8') if body.respond_to?(:force_encoding)
31+
@body = body.force_encoding('UTF-8') if body.respond_to?(:force_encoding) && !body.frozen?
3232
end
3333
end
3434

0 commit comments

Comments
 (0)