File: generic.rb

package info (click to toggle)
ruby-protocol-http 0.59.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 864 kB
  • sloc: ruby: 7,612; makefile: 4
file content (30 lines) | stat: -rw-r--r-- 914 bytes parent folder | download
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
27
28
29
30
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.

require_relative "split"

module Protocol
	module HTTP
		module Header
			# Represents generic or custom headers that can be used in trailers.
			#
			# This class is used as the default policy for headers not explicitly defined in the POLICY hash.
			#
			# It allows generic headers to be used in HTTP trailers, which is important for:
			# - Custom application headers.
			# - gRPC status headers (grpc-status, grpc-message).
			# - Headers used by proxies and middleware.
			# - Future HTTP extensions.
			class Generic < Split
				# Whether this header is acceptable in HTTP trailers.
				# Generic headers are allowed in trailers by default to support extensibility.
				# @returns [Boolean] `true`, generic headers are allowed in trailers.
				def self.trailer?
					true
				end
			end
		end
	end
end