File tree Expand file tree Collapse file tree 2 files changed +35
-2
lines changed
Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -110,5 +110,29 @@ public void POST_with_resource_containing_tokens()
110110 Assert . Equal ( expected , output ) ;
111111 }
112112
113+ [ Fact ]
114+ public void GET_with_empty_request ( )
115+ {
116+ var request = new RestRequest ( ) ;
117+ var client = new RestClient ( "http://example.com/resource" ) ;
118+
119+ var expected = new Uri ( "http://example.com/resource" ) ;
120+ var output = client . BuildUri ( request ) ;
121+
122+ Assert . Equal ( expected , output ) ;
123+ }
124+
125+ [ Fact ]
126+ public void GET_with_empty_request_and_bare_hostname ( )
127+ {
128+ var request = new RestRequest ( ) ;
129+ var client = new RestClient ( "http://example.com" ) ;
130+
131+ var expected = new Uri ( "http://example.com/" ) ;
132+ var output = client . BuildUri ( request ) ;
133+
134+ Assert . Equal ( expected , output ) ;
135+ }
136+
113137 }
114138}
Original file line number Diff line number Diff line change @@ -304,8 +304,17 @@ public Uri BuildUri(IRestRequest request)
304304 assembled = assembled . Substring ( 1 ) ;
305305 }
306306
307- if ( ! string . IsNullOrEmpty ( BaseUrl ) )
308- assembled = string . Format ( "{0}/{1}" , BaseUrl , assembled ) ;
307+ if ( ! string . IsNullOrEmpty ( BaseUrl ) )
308+ {
309+ if ( string . IsNullOrEmpty ( assembled ) )
310+ {
311+ assembled = BaseUrl ;
312+ }
313+ else
314+ {
315+ assembled = string . Format ( "{0}/{1}" , BaseUrl , assembled ) ;
316+ }
317+ }
309318
310319 if ( request . Method != Method . POST && request . Method != Method . PUT && request . Method != Method . PATCH )
311320 {
You can’t perform that action at this time.
0 commit comments