File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -587,7 +587,7 @@ private void WritePath(StringBuilder builder)
587587 if ( builder . Length > start )
588588 builder . Append ( '/' ) ;
589589
590- var v = Uri . EscapeDataString ( p ) ;
590+ var v = Uri . EscapeDataString ( p ?? string . Empty ) ;
591591
592592 builder . Append ( v ) ;
593593 }
Original file line number Diff line number Diff line change @@ -204,4 +204,26 @@ public void BuildBasePath()
204204 builder . ToString ( ) . Should ( ) . Be ( "http://foo.com/test/bar?test=True" ) ;
205205
206206 }
207+
208+ [ Fact ]
209+ public void BuildBaseRelativePath ( )
210+ {
211+ var builder = UrlBuilder
212+ . Create ( "/foo" )
213+ . AppendPath ( "/bar" )
214+ . AppendQuery ( "test" , true ) ;
215+
216+ builder . Scheme . Should ( ) . BeEmpty ( ) ;
217+ builder . Host . Should ( ) . BeEmpty ( ) ;
218+ builder . Port . Should ( ) . BeNull ( ) ;
219+
220+ builder . Path . Should ( ) . NotBeEmpty ( ) ;
221+ builder . Path . Should ( ) . Contain ( "foo" ) ;
222+ builder . Path . Should ( ) . Contain ( "bar" ) ;
223+
224+ builder . Query . AllKeys . Length . Should ( ) . BeGreaterThan ( 0 ) ;
225+ builder . Query . AllKeys . Should ( ) . Contain ( "test" ) ;
226+
227+ builder . ToString ( ) . Should ( ) . Be ( "/foo/bar?test=True" ) ;
228+ }
207229}
You can’t perform that action at this time.
0 commit comments