Ensure content length when empty body, hook up httpclient to logger when debugging
This commit is contained in:
parent
aed2936248
commit
489378db58
|
@ -84,6 +84,8 @@ module Google
|
|||
# Base service for all APIs. Not to be used directly.
|
||||
#
|
||||
class BaseService
|
||||
include Logging
|
||||
|
||||
# Root URL (host/port) for the API
|
||||
# @return [Addressable::URI]
|
||||
attr_accessor :root_url
|
||||
|
@ -393,6 +395,8 @@ module Google
|
|||
end
|
||||
client.follow_redirect_count = 5
|
||||
client.default_header = { 'User-Agent' => user_agent }
|
||||
|
||||
client.debug_dev = logger if logger.level == Logger::DEBUG
|
||||
client
|
||||
end
|
||||
|
||||
|
|
|
@ -155,6 +155,12 @@ module Google
|
|||
else
|
||||
@form_encoded = false
|
||||
end
|
||||
|
||||
unless body
|
||||
self.header['Content-Type'] = 'application/json'
|
||||
self.header['Content-Length'] = 0
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Release any resources used by this command
|
||||
|
|
Loading…
Reference in New Issue