Skip to content

Commit

Permalink
Merge pull request #864 from HoneyryderChuck/fix-uri-param-in-uri
Browse files Browse the repository at this point in the history
URI sig improvements
  • Loading branch information
soutaro authored Feb 7, 2022
2 parents db94eec + 753e1c7 commit dafabf3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stdlib/uri/0/generic.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ module URI
# uri.merge!("/main.rbx?page=1")
# uri.to_s # => "http://my.example.com/main.rbx?page=1"
#
def merge!: (string oth) -> String
def merge!: (URI::Generic | string oth) -> String

# <!--
# rdoc-file=lib/uri/generic.rb
Expand All @@ -904,7 +904,7 @@ module URI
# uri.merge("/main.rbx?page=1")
# # => "http://my.example.com/main.rbx?page=1"
#
def merge: (string oth) -> URI::Generic
def merge: (URI::Generic | string oth) -> URI::Generic

# :stopdoc:
def route_from_path: (String src, String dst) -> String
Expand Down
35 changes: 35 additions & 0 deletions stdlib/uri/0/http.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,41 @@ module URI
def self.build: (Array[String | Integer] args) -> URI::HTTP
| ({ userinfo: String, host: String, port: Integer, path: String, query: String, fragment: String }) -> URI::HTTP

# <!--
# rdoc-file=lib/uri/http.rb
# - authority()
# -->
# ## Description
#
# Returns the authority for an HTTP uri, as defined in
# https://datatracker.ietf.org/doc/html/rfc3986/#section-3.2.
#
# Example:
#
# URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').authority #=> "www.example.com"
# URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').authority #=> "www.example.com:8000"
# URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').authority #=> "www.example.com"
#
def authority: () -> String

# <!--
# rdoc-file=lib/uri/http.rb
# - origin()
# -->
# ## Description
#
# Returns the origin for an HTTP uri, as defined in
# https://datatracker.ietf.org/doc/html/rfc6454.
#
# 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"
#
def origin: () -> String

# <!--
# rdoc-file=lib/uri/http.rb
# - request_uri()
Expand Down

0 comments on commit dafabf3

Please sign in to comment.