@@ -15,24 +15,37 @@ namespace ImageWizard;
1515public static class ImageWizardExtensions
1616{
1717 /// <summary>
18- /// Maps ImageWizard API with specified base path.
18+ /// Maps ImageWizard endpoint with specified base path.
1919 /// </summary>
2020 /// <param name="endpoints"></param>
2121 /// <param name="path"></param>
2222 /// <returns></returns>
23- private static IEndpointConventionBuilder MapImageWizard ( this IEndpointRouteBuilder endpoints )
23+ public static IEndpointConventionBuilder MapImageWizard ( this IEndpointRouteBuilder endpoints , string path = ImageWizardDefaults . BasePath )
2424 {
2525 return endpoints
26- . MapMethods ( "{ signature}/{ *path}", new [ ] { HttpMethods . Get , HttpMethods . Head } , new ImageWizardApi ( ) . ExecuteAsync )
26+ . MapMethods ( $ " { path } /{{ signature}}/{{ *path}} ", new [ ] { HttpMethods . Get , HttpMethods . Head } , ImageWizardApi . ExecuteAsync )
2727 . WithName ( "ImageWizard" ) ;
2828 }
2929
30+ /// <summary>
31+ /// Use ImageWizard middleware.
32+ /// </summary>
33+ /// <param name="builder"></param>
34+ /// <param name="endpointsHandler"></param>
35+ /// <returns></returns>
3036 public static IApplicationBuilder UseImageWizard ( this IApplicationBuilder builder , Action < IImageWizardEndpointBuilder > ? endpointsHandler = null )
3137 {
3238 return UseImageWizard ( builder , ImageWizardDefaults . BasePath , endpointsHandler ) ;
3339 }
3440
35- public static IApplicationBuilder UseImageWizard ( this IApplicationBuilder builder , PathString path , Action < IImageWizardEndpointBuilder > ? endpointsHandler = null )
41+ /// <summary>
42+ /// Use ImageWizard middleware with specified base path.
43+ /// </summary>
44+ /// <param name="builder"></param>
45+ /// <param name="path"></param>
46+ /// <param name="endpointsHandler"></param>
47+ /// <returns></returns>
48+ public static IApplicationBuilder UseImageWizard ( this IApplicationBuilder builder , string path , Action < IImageWizardEndpointBuilder > ? endpointsHandler = null )
3649 {
3750 builder . Map ( path , x =>
3851 {
@@ -41,7 +54,7 @@ public static IApplicationBuilder UseImageWizard(this IApplicationBuilder builde
4154 {
4255 endpointsHandler ? . Invoke ( new ImageWizardEndpointBuilder ( endpoints ) ) ;
4356
44- endpoints . MapImageWizard ( ) ;
57+ endpoints . MapImageWizard ( string . Empty ) ;
4558 } ) ;
4659 } ) ;
4760
0 commit comments