@@ -1770,6 +1770,15 @@ Task<string> FetchSomeStuffWithHardcodedAndOtherQueryParameters(
17701770 [ Get ( "/foo/bar?param=first {id} and second {id}" ) ]
17711771 Task < string > FetchSomeStuffWithTheIdInAParameterMultipleTimes ( int id ) ;
17721772
1773+ [ Get ( "/foo?q=app_metadata.id:\" {id}\" " ) ]
1774+ Task < string > FetchSomeStuffWithDoubleQuotesInUrl ( int id ) ;
1775+
1776+ [ Get ( "/foo/bar/({id})" ) ]
1777+ Task < string > GetWithTrainingParenthesis ( int id ) ;
1778+
1779+ [ Get ( "/foo/bar/{id}/" ) ]
1780+ Task < string > GetWithTrailingSlash ( int id ) ;
1781+
17731782 [ Post ( "/foo/bar/{id}" ) ]
17741783 [ Headers ( "Content-Type: literally/anything" ) ]
17751784 Task < string > PostSomeStuffWithHardCodedContentTypeHeader ( int id , [ Body ] string content ) ;
@@ -2594,6 +2603,37 @@ public void QueryParamWithPathDelimiterShouldBeEncoded()
25942603 ) ;
25952604 }
25962605
2606+ [ Fact ]
2607+ public void QueryParamWhichEndsInDoubleQuotesShouldNotBeTruncated ( )
2608+ {
2609+ var fixture = new RequestBuilderImplementation < IDummyHttpApi > ( ) ;
2610+ var factory = fixture . BuildRequestFactoryForMethod (
2611+ "FetchSomeStuffWithDoubleQuotesInUrl"
2612+ ) ;
2613+ var output = factory ( [ 42 ] ) ;
2614+
2615+ var uri = new Uri ( new Uri ( "http://api" ) , output . RequestUri ! ) ;
2616+
2617+ Assert . Equal ( "/foo?q=app_metadata.id%3A%2242%22" , uri . PathAndQuery ) ;
2618+ }
2619+
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+
25972637 [ Fact ]
25982638 public void ParameterizedQueryParamsShouldBeInUrlAndValuesEncodedWhenMixedReplacementAndQueryBadId ( )
25992639 {
0 commit comments