Sponsor: Using RabbitMQ or Azure Service Bus in your .NET systems? Well, you could just use their SDKs and roll your own serialization, routing, outbox, retries, and telemetry. I mean, seriously, how hard could it be?

Compressing
I’ve basically taken Simon’s code and added it to a new class that implements IApplicationStartup. There are a few checks that occur before compressing the output.- Does the incoming request accept header contain gzip?
- Is the outgoing HTTP status code 200?
- Is return content type compatible? In my example, I’m only checking for application/json.
- Is return content length large enough?
Wiring Up
One reason I really love Nancy is how it scans assemblies looking for implementations of interfaces. This makes it so seamless to add functionality. Adding this class to your project is all you need to do. Seriously. This is indeed the super-duper-happy-path. You can also hook into the pipeline via the bootstrapper, I just happened to prefer creating a class that implements the IApplicationStartup as I can easily reuse it by dropping it into other projects.Results
In my demo project, I’ve added a a json file with generated data. I’m output this file at the endpoint /nancy/gziptest. Without gzip
