Method: Webhookdb::Http.post
- Defined in:
- lib/webhookdb/http.rb
.post(url, body = {}, headers: {}, method: nil, check: true, **options) ⇒ Object
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/webhookdb/http.rb', line 75 def self.post(url, body={}, headers: {}, method: nil, check: true, **, &) self._setup_required_args() headers["Content-Type"] ||= "application/json" headers["User-Agent"] = self.user_agent body = body.to_json if !body.is_a?(String) && headers["Content-Type"].include?("json") opts = {body:, headers:}.merge(**) r = HTTParty.send(method || :post, url, **opts, &) self.check!(r, **) if check return r end |