Class: Honeybadger::Util::HTTP
- Inherits:
-
Object
- Object
- Honeybadger::Util::HTTP
- Extended by:
- Forwardable
- Includes:
- Logging::Helper
- Defined in:
- lib/honeybadger/util/http.rb
Constant Summary collapse
- HEADERS =
{ 'Content-type'.freeze => 'application/json'.freeze, 'Content-Encoding'.freeze => 'deflate'.freeze, 'Accept'.freeze => 'text/json, application/json'.freeze, 'User-Agent'.freeze => "HB-Ruby #{VERSION}; #{RUBY_VERSION}; #{RUBY_PLATFORM}".freeze }.freeze
Instance Method Summary collapse
-
#initialize(config) ⇒ HTTP
constructor
A new instance of HTTP.
- #post(endpoint, payload, headers = nil) ⇒ Object
Constructor Details
#initialize(config) ⇒ HTTP
Returns a new instance of HTTP.
24 25 26 |
# File 'lib/honeybadger/util/http.rb', line 24 def initialize(config) @config = config end |
Instance Method Details
#post(endpoint, payload, headers = nil) ⇒ Object
28 29 30 31 32 |
# File 'lib/honeybadger/util/http.rb', line 28 def post(endpoint, payload, headers = nil) response = http_connection.post(endpoint, compress(payload.to_json), http_headers(headers)) debug { sprintf("http method=POST path=%s code=%d", endpoint.dump, response.code) } response end |