Sha256: 9af86fc513c8fd024707c63bbec18e8184c1e92ce48c8984c06b9202b09b83ae

Contents?: true

Size: 931 Bytes

Versions: 1

Compression:

Stored size: 931 Bytes

Contents

module Noder
  module HTTP
    class Request
      attr_accessor :params
      attr_reader :env
      
      def initialize(env)
        @env = env
        @query = HTTP::Utils.parse(env[:query_string])
        @params = @query
        if env[:post_content] && env[:post_content] != ''
          @params.merge!(HTTP::Utils.parse(env[:post_content]))
        end
      end

      def headers
        @headers ||= HTTP::Utils.parse_headers(env[:headers])
      end

      def request_method
        env[:request_method]
      end

      def cookie
        env[:cookie]
      end

      def content_type
        env[:content_type]
      end

      def request_uri
        env[:request_uri]
      end

      def query_string
        env[:query_string]
      end

      def post_content
        env[:post_content]
      end

      def protocol
        env[:protocol]
      end

      def ip
        env[:ip]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
noder-0.0.2 lib/noder/http/request.rb