Module: HTTPX::Plugins::ServerSentEvents::InstanceMethods

Defined in:
lib/httpx/plugins/server_sent_events.rb

Instance Method Summary collapse

Instance Method Details

#build_requestObject



49
50
51
52
53
54
55
56
# File 'lib/httpx/plugins/server_sent_events.rb', line 49

def build_request(*)
  super.tap do |request|
    if request.options.event_stream
      request.headers["accept"] = "text/event-stream"
      request.headers["cache-control"] = "no-cache"
    end
  end
end

#request(*args, **options) ⇒ Object



43
44
45
46
47
# File 'lib/httpx/plugins/server_sent_events.rb', line 43

def request(*args, **options)
  options[:stream] = true if options[:event_stream]

  super
end