File: http_client.rb

package info (click to toggle)
ruby-samuel 0.3.3-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, trixie
  • size: 172 kB
  • sloc: ruby: 735; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 523 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module Samuel
  module LogEntries
    class HttpClient < Base
      extend Forwardable

      def_delegators :"@request.header.request_uri",
                     :host, :path, :query, :scheme, :port

      def method
        @request.header.request_method
      end

      def status_code
        @response.status
      end

      def status_message
        @response.header.reason_phrase.strip
      end

      def error?
        @response.is_a?(Exception) || @response.status.to_s =~ /^(4|5)/
      end
    end
  end
end