Class: Protocol::HTTP::Header::ETag

Inherits:
String
  • Object
show all
Defined in:
lib/protocol/http/header/etag.rb

Overview

The ‘etag` header represents the entity tag for a resource.

The ‘etag` header provides a unique identifier for a specific version of a resource, typically used for cache validation or conditional requests. It can be either a strong or weak validator as defined in RFC 9110.

Instance Method Summary collapse

Instance Method Details

#<<(value) ⇒ Object

Replaces the current value of the ‘etag` header with the specified value.



16
17
18
# File 'lib/protocol/http/header/etag.rb', line 16

def << value
	replace(value)
end

#weak?Boolean

Checks whether the ‘etag` is a weak validator.

Weak validators indicate semantically equivalent content but may not be byte-for-byte identical.

Returns:

  • (Boolean)


25
26
27
# File 'lib/protocol/http/header/etag.rb', line 25

def weak?
	self.start_with?("W/")
end