Adds CSV support to Nancy using CsvHelper
Add the csvialize NuGet package to your project in the manner applicable to you.
If you're using Nancy's auto-registration, there should be no additional work to do. Requests with an Accept: text/csv
header will be negotiated as CSV output.
It may be desirable to change the order of the default IResponseProcessor
so that requests without an Accept
header are negotiated as desired. For example, this will ensure that Csvialize is the default response processor.
public class CsvFirstBootstrapper : DefaultNancyBootstrapper
{
protected override NancyInternalConfiguration InternalConfiguration => NancyInternalConfiguration.WithOverrides(c =>
{
// Remove Csvialize if it exists
c.ResponseProcessors.Remove(typeof(Csvialize.CsvProcessor));
// Insert it at the start of the list
c.ResponseProcessors.Insert(0, typeof(Csvialize.CsvProcessor));
});
}
See The response processors in the Nancy wiki for more information.
This library is built with .NET Core
To build the project:
dotnet restore
dotnet build
To run the tests:
dotnet test
We are committed to fostering an open and welcoming environment. Please read our code of conduct before participating in or contributing to this project.
We welcome contributions and collaboration on this project. Please read our contributor's guide to understand how best to work with us.
This software is made available by GMV Syncromatics Engineering under the MIT license.