Skip to content

Commit fc06c57

Browse files
perf: check for allowUnmatchedParameter before calling IndexOf (#2252)
1 parent b920e21 commit fc06c57

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/Refit/GeneratedRequestRunner.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,13 @@ value is not null
654654
/// <returns>The validated path, returned unchanged.</returns>
655655
private static string ThrowIfUnmatchedParameter(string path, string relativePathTemplate, bool allowUnmatchedParameter)
656656
{
657+
if (allowUnmatchedParameter)
658+
{
659+
return path;
660+
}
661+
657662
var i = path.IndexOf('{');
658-
if (i < 0 || allowUnmatchedParameter)
663+
if (i < 0)
659664
{
660665
return path;
661666
}

0 commit comments

Comments
 (0)