Skip to content

Commit

Permalink
Exposing raw_body instead of raw_request.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasuyezu committed Oct 9, 2013
1 parent 9934d6d commit 45c9b55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/httparty/logger/curl_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def format(request, response)
end
end

print_outgoing request.raw_request.body if request.raw_request && request.raw_request.body
print_outgoing request.raw_body
print_outgoing ""
print_incoming "HTTP/#{response.http_version} #{response.code}"

Expand Down
6 changes: 5 additions & 1 deletion lib/httparty/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Request #:nodoc:
end

attr_accessor :http_method, :options, :last_response, :redirect, :last_uri
attr_reader :path, :raw_request

This comment has been minimized.

Copy link
@misfo

misfo Oct 22, 2013

Contributor

Why remove this reader? We're using this for custom logging which needs the full request that httparty generated (not just the body)

This comment has been minimized.

Copy link
@jnunemaker

jnunemaker Oct 22, 2013

Owner

This was a removal of an addition that was never in a released version. See this pull: #243

This comment has been minimized.

Copy link
@misfo

misfo Oct 23, 2013

Contributor

Alrighty. We're using instance_varaible_get which works fine. I was just wondering if there was a specific reason for not exposing the request...

This comment has been minimized.

Copy link
@jnunemaker

jnunemaker Oct 24, 2013

Owner

In general I am opposed to exposing things. If you are using it for logging I would love for you to try the new logging stuff and see if that works for you. If it does not, I would like to make it better. Exposing internals is a good way for things to break like this.

attr_reader :path

def initialize(http_method, path, o={})
self.http_method = http_method
Expand Down Expand Up @@ -107,6 +107,10 @@ def perform(&block)
handle_response(chunked_body, &block)
end

def raw_body
@raw_request.body
end

private

def http
Expand Down

0 comments on commit 45c9b55

Please sign in to comment.