@@ -40,6 +40,7 @@ private static void MapGetAll(this IEndpointRouteBuilder builder)
4040 }
4141
4242 NpmPackageListAllResponse ? result = instance ? . All ( ) ;
43+
4344 return Results . Json ( result , UnityNuGetJsonSerializerContext . Default ) ;
4445 } ) ;
4546 }
@@ -54,6 +55,7 @@ private static void MapGetPackage(this IEndpointRouteBuilder builder)
5455 }
5556
5657 NpmPackage ? package = instance ? . GetPackage ( id ) ;
58+
5759 if ( package == null )
5860 {
5961 return Results . Json ( NpmError . NotFound , UnityNuGetJsonSerializerContext . Default ) ;
@@ -73,6 +75,7 @@ private static void MapDownloadPackage(this IEndpointRouteBuilder builder)
7375 }
7476
7577 NpmPackage ? package = instance ? . GetPackage ( id ) ;
78+
7679 if ( package == null )
7780 {
7881 return Results . Json ( NpmError . NotFound , UnityNuGetJsonSerializerContext . Default ) ;
@@ -84,6 +87,7 @@ private static void MapDownloadPackage(this IEndpointRouteBuilder builder)
8487 }
8588
8689 string ? filePath = instance ? . GetPackageFilePath ( file ) ;
90+
8791 if ( string . IsNullOrEmpty ( filePath ) || ! File . Exists ( filePath ) )
8892 {
8993 return Results . Json ( NpmError . NotFound , UnityNuGetJsonSerializerContext . Default ) ;
@@ -94,6 +98,7 @@ private static void MapDownloadPackage(this IEndpointRouteBuilder builder)
9498 {
9599 httpContext . Response . ContentType = "application/octet-stream" ;
96100 httpContext . Response . ContentLength = new FileInfo ( filePath ) . Length ;
101+
97102 return Results . Ok ( ) ;
98103 }
99104 else
@@ -174,6 +179,7 @@ private static void MapStatus(this IEndpointRouteBuilder builder)
174179 string output = Template
175180 . Parse ( text )
176181 . Render ( templateContext ) ;
182+
177183 await context . Response . WriteAsync ( output ) ;
178184 } ) ;
179185 }
0 commit comments