instance method
URI::HTTP#origin
() -> ::String
origin
lib/uri/http.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/uri/http.rb, line 131
def origin
"#{scheme}://#{authority}"
end
Description
Returns the origin for an HTTP uri, as defined in www.rfc-editor.org/rfc/rfc6454.
Example:
Example
URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').origin #=> "http://www.example.com" URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').origin #=> "http://www.example.com:8000" URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').origin #=> "http://www.example.com" URI::HTTPS.build(host: 'www.example.com', path: '/foo/bar').origin #=> "https://www.example.com"