Sha256: 7cf63565026290fde1f1ba2d53fd289aeb05c85677be9ccac48991414bb501e3

Contents?: true

Size: 642 Bytes

Versions: 20

Compression:

Stored size: 642 Bytes

Contents

module Billy
  class RequestLog
    attr_reader :requests

    def initialize
      @requests = []
    end

    def reset
      @requests = []
    end

    def record(method, url, headers, body)
      return unless Billy.config.record_requests

      request = {
        status: :inflight,
        handler: nil,
        method: method,
        url: url,
        headers: headers,
        body: body
      }
      @requests.push(request)

      request
    end

    def complete(request, handler)
      return unless Billy.config.record_requests

      request.merge! status: :complete,
                     handler: handler
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
puffing-billy-4.0.0 lib/billy/handlers/request_log.rb
puffing-billy-3.2.0 lib/billy/handlers/request_log.rb
puffing-billy-3.1.0 lib/billy/handlers/request_log.rb
puffing-billy-3.0.4 lib/billy/handlers/request_log.rb
puffing-billy-3.0.3 lib/billy/handlers/request_log.rb
puffing-billy-3.0.2 lib/billy/handlers/request_log.rb
puffing-billy-3.0.1 lib/billy/handlers/request_log.rb
puffing-billy-3.0.0 lib/billy/handlers/request_log.rb
puffing-billy-2.4.1 lib/billy/handlers/request_log.rb
puffing-billy-2.4.0 lib/billy/handlers/request_log.rb
puffing-billy-2.3.1 lib/billy/handlers/request_log.rb
puffing-billy-2.3.0 lib/billy/handlers/request_log.rb
puffing-billy-2.2.0 lib/billy/handlers/request_log.rb
puffing-billy-2.1.1 lib/billy/handlers/request_log.rb
puffing-billy-2.1.0 lib/billy/handlers/request_log.rb
puffing-billy-2.0.0 lib/billy/handlers/request_log.rb
puffing-billy-1.1.3 lib/billy/handlers/request_log.rb
puffing-billy-1.1.2 lib/billy/handlers/request_log.rb
puffing-billy-1.1.1 lib/billy/handlers/request_log.rb
puffing-billy-1.1.0 lib/billy/handlers/request_log.rb