@@ -1773,6 +1773,12 @@ Task<string> FetchSomeStuffWithHardcodedAndOtherQueryParameters(
17731773 [ Get ( "/foo?q=app_metadata.id:\" {id}\" " ) ]
17741774 Task < string > FetchSomeStuffWithDoubleQuotesInUrl ( int id ) ;
17751775
1776+ [ Get ( "/foo/bar/({id})" ) ]
1777+ Task < string > GetWithTrainingParenthesis ( int id ) ;
1778+
1779+ [ Get ( "/foo/bar/{id}/" ) ]
1780+ Task < string > GetWithTrailingSlash ( int id ) ;
1781+
17761782 [ Post ( "/foo/bar/{id}" ) ]
17771783 [ Headers ( "Content-Type: literally/anything" ) ]
17781784 Task < string > PostSomeStuffWithHardCodedContentTypeHeader ( int id , [ Body ] string content ) ;
@@ -2604,13 +2610,30 @@ public void QueryParamWhichEndsInDoubleQuotesShouldNotBeTruncated()
26042610 var factory = fixture . BuildRequestFactoryForMethod (
26052611 "FetchSomeStuffWithDoubleQuotesInUrl"
26062612 ) ;
2607- var output = factory ( new object [ ] { 42 } ) ;
2613+ var output = factory ( [ 42 ] ) ;
26082614
2609- var uri = new Uri ( new Uri ( "http://api" ) , output . RequestUri ) ;
2615+ var uri = new Uri ( new Uri ( "http://api" ) , output . RequestUri ! ) ;
26102616
26112617 Assert . Equal ( "/foo?q=app_metadata.id%3A%2242%22" , uri . PathAndQuery ) ;
26122618 }
26132619
2620+ [ Theory ]
2621+ [ InlineData ( "GetWithTrainingParenthesis" , ")" , "/foo/bar/(1)" ) ]
2622+ [ InlineData ( "GetWithTrailingSlash" , "/" , "/foo/bar/1/" ) ]
2623+ public void ShouldCaptureLastCharacterWhenRouteEndsWithConstant ( string methodToTest , string constantChar , string contains )
2624+ {
2625+ var fixture = new RequestBuilderImplementation < IDummyHttpApi > ( ) ;
2626+ var factory = fixture . BuildRequestFactoryForMethod (
2627+ methodToTest
2628+ ) ;
2629+ var output = factory ( [ "1" ] ) ;
2630+
2631+ var uri = new Uri ( new Uri ( "http://api/" ) , output . RequestUri ! ) ;
2632+
2633+ Assert . EndsWith ( constantChar , uri . PathAndQuery , StringComparison . Ordinal ) ;
2634+ Assert . Contains ( contains , uri . PathAndQuery , StringComparison . Ordinal ) ;
2635+ }
2636+
26142637 [ Fact ]
26152638 public void ParameterizedQueryParamsShouldBeInUrlAndValuesEncodedWhenMixedReplacementAndQueryBadId ( )
26162639 {
0 commit comments