Sha256: 03143e668303b42052b5801a5983b43126bfe354a3ebdc2fb5b3c1bf9923d90d
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require "rack/utils" module Hanami # @since 0.1.0 # @api private module Http # An HTTP status # # @since 0.1.0 # @api private class Status # A set of standard codes and messages for HTTP statuses # # @since 0.1.0 # @api private ALL = ::Rack::Utils::HTTP_STATUS_CODES # Return a status for the given code # # @param code [Integer] a valid HTTP code # # @return [Array] a pair of code and message for an HTTP status # # @since 0.1.0 # @api private # # @example # require 'hanami/http/status' # # Hanami::Http::Status.for_code(418) # => [418, "I'm a teapot"] def self.for_code(code) ALL.assoc(code) end # Return a message for the given status code # # @param code [Integer] a valid HTTP code # # @return [String] a message for the given status code # # @since 0.3.2 # @api private def self.message_for(code) for_code(code)[1] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hanami-controller-2.0.1 | lib/hanami/http/status.rb |
hanami-controller-2.0.0 | lib/hanami/http/status.rb |
hanami-controller-2.0.0.rc1 | lib/hanami/http/status.rb |