@@ -56,12 +56,14 @@ module HTTP
5656 ?body: untyped ,
5757 ?follow: bool ,
5858 ?retriable: bool ,
59+ ?base_uri: String | URI | nil ,
5960 ?persistent: String?,
6061 ?ssl_context: OpenSSL::SSL::SSLContext?
6162 ) -> Response
6263 def timeout : (Numeric | Hash[Symbol, Numeric] | :null options) -> Session
63- def persistent : (String host, ?timeout: Integer) -> Client
64- | (String host, ?timeout: Integer) { (Client) -> void } -> void
64+ def base_uri : (String | URI uri) -> Session
65+ def persistent : (?String? host, ?timeout: Integer) -> Client
66+ | (?String? host, ?timeout: Integer) { (Client) -> void } -> void
6567 def via : (*(String | Integer | Hash[String, String]) proxy) -> Session
6668 alias through via
6769 def follow : (?strict: bool , ?max_hops: Integer, ?on_redirect: (^(Response, Request) -> void )?) -> Session
@@ -116,6 +118,7 @@ module HTTP
116118 ?body: untyped ,
117119 ?follow: bool ,
118120 ?retriable: bool ,
121+ ?base_uri: String | URI | nil ,
119122 ?persistent: String?,
120123 ?ssl_context: OpenSSL::SSL::SSLContext?
121124 ) -> Response
@@ -164,6 +167,7 @@ module HTTP
164167 ?body: untyped ,
165168 ?follow: bool ,
166169 ?retriable: bool ,
170+ ?base_uri: String | URI | nil ,
167171 ?persistent: String?,
168172 ?ssl_context: OpenSSL::SSL::SSLContext?
169173 ) -> Response
@@ -495,6 +499,7 @@ module HTTP
495499 ?body: untyped ,
496500 ?follow: bool ,
497501 ?retriable: bool ,
502+ ?base_uri: String | URI | nil ,
498503 ?persistent: String?,
499504 ?ssl_context: OpenSSL::SSL::SSLContext?
500505 ) -> void
@@ -504,6 +509,8 @@ module HTTP
504509
505510 def follow= : (bool value) -> void
506511 def retriable= : (bool value) -> void
512+ def base_uri= : (String | URI | nil value) -> void
513+ def base_uri? : () -> bool
507514 def persistent= : (String? value) -> String?
508515 def persistent? : () -> bool
509516 def merge : (Hash[Symbol, untyped ] | Options other) -> Options
@@ -530,13 +537,15 @@ module HTTP
530537 attr_accessor encoding: Encoding?
531538 attr_reader follow: Hash[Symbol, untyped ]?
532539 attr_reader retriable: Hash[Symbol, untyped ]?
540+ attr_reader base_uri: URI?
533541 attr_reader persistent: String?
534542
535543 def with_headers : (Hash[String | Symbol, untyped ] | Headers value) -> Options
536544 def with_encoding : (String | Encoding value) -> Options
537545 def with_features : (Array[Symbol | Hash[Symbol, untyped ]] value) -> Options
538546 def with_follow : (Hash[Symbol, untyped ] | bool value) -> Options
539547 def with_retriable : (Hash[Symbol, untyped ] | bool value) -> Options
548+ def with_base_uri : (String | URI value) -> Options
540549 def with_persistent : (String value) -> Options
541550 def with_proxy : (Hash[Symbol, untyped ] value) -> Options
542551 def with_params : (Hash[String | Symbol, untyped ] value) -> Options
@@ -557,6 +566,9 @@ module HTTP
557566
558567 def assign_options : (Binding env) -> void
559568 def argument_error! : (String message) -> bot
569+ def parse_base_uri : (String | URI value) -> URI
570+ def resolve_base_uri : (URI base, URI relative) -> URI
571+ def validate_base_uri_and_persistent! : () -> void
560572 end
561573
562574 class URI
@@ -651,6 +663,7 @@ module HTTP
651663 private
652664
653665 def make_request_uri : (String | URI uri) -> URI
666+ def resolve_against_base : (String uri) -> String
654667 def merge_query_params! : (URI uri) -> void
655668 def make_request_headers : () -> Headers
656669 def make_request_body : (Headers headers) -> untyped
0 commit comments