Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Gramli committed Apr 8, 2024
1 parent 9c8870e commit 6eecce9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,3 @@ Solution contains four layers:
* [Moq](https://github.com/moq/moq4)
* [Xunit](https://github.com/xunit/xunit)
* [ChoETL](https://github.com/Cinchoo/ChoETL)

## Tips
Uploading File with parametrs: **Notice that the controller action does not take any parameters. That's because we process the request body inside the action, without invoking a media-type formatter. ** https://learn.microsoft.com/en-us/aspnet/web-api/overview/advanced/sending-html-form-data-part-2
1 change: 1 addition & 0 deletions src/File.API/EndpointBuilders/FileEndpointsBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ private static IEndpointRouteBuilder BuildExportEndpoints(this IEndpointRouteBui
endpointRouteBuilder.MapPost("v1/convert",
async (IFormFile file, string formatToExport, [FromServices] IConvertToQueryHandler handler, CancellationToken cancellationToken) =>
await handler.GetFileAsync(new ConvertToQuery(new FormFileProxy(file), formatToExport), cancellationToken))
.DisableAntiforgery()
.Produces<FileContentHttpResult>()
.WithName("ConvertTo")
.WithTags("Post");
Expand Down
2 changes: 1 addition & 1 deletion src/File.Domain/Dtos/FileDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public class FileDto

public long Length { get; init; }

public byte[] Data { get; init; } = new byte[0];
public byte[] Data { get; init; } = [];
}
}

0 comments on commit 6eecce9

Please sign in to comment.