@@ -91,21 +91,21 @@ private static void ValidateRequest(HttpRequestMessage requestMessage, out bool
9191 if ( requestMessage . RequestUri is null )
9292 {
9393 throw new AnthropicInvalidDataException (
94- "Request is missing required path segments. Expected > 1 segments found none."
94+ "Request is missing required path segments. Expected > 1 segments, found none."
9595 ) ;
9696 }
9797
9898 if ( requestMessage . RequestUri . Segments . Length < 1 )
9999 {
100100 throw new AnthropicInvalidDataException (
101- "Request is missing required path segments. Expected > 1 segments found none."
101+ "Request is missing required path segments. Expected > 1 segments, found none."
102102 ) ;
103103 }
104104
105105 if ( requestMessage . RequestUri . Segments [ 1 ] . Trim ( '/' ) != "v1" )
106106 {
107107 throw new AnthropicInvalidDataException (
108- $ "Request is missing required path segments. Expected [0] segment to be 'v1' found { requestMessage . RequestUri . Segments [ 0 ] } ."
108+ $ "Request is missing required path segments. Expected [0] segment to be 'v1', found { requestMessage . RequestUri . Segments [ 0 ] } ."
109109 ) ;
110110 }
111111
@@ -119,17 +119,10 @@ private static void ValidateRequest(HttpRequestMessage requestMessage, out bool
119119 $ "The requested endpoint '{ requestMessage . RequestUri . Segments . Last ( ) . Trim ( '/' ) } ' is not yet supported."
120120 ) ;
121121 }
122- if (
122+
123+ isCountEndpoint =
123124 requestMessage . RequestUri . Segments . Length >= 4
124125 && requestMessage . RequestUri . Segments [ 2 ] . Trim ( '/' ) is "messages"
125- && requestMessage . RequestUri . Segments [ 3 ] . Trim ( '/' ) is "count_tokens"
126- )
127- {
128- isCountEndpoint = true ;
129- }
130- else
131- {
132- isCountEndpoint = false ;
133- }
126+ && requestMessage . RequestUri . Segments [ 3 ] . Trim ( '/' ) is "count_tokens" ;
134127 }
135128}
0 commit comments