Exploring Neon as a Serverless Postgres Alternative for .NET Applications on Azure - Part 1 (Simple ASP.NET Core on App Service)10 lut 2025
Blog | programowanie | .net | c# | azure | IT
Every ASP.NET Core release is accompanied by a number of blog posts, demos, and videos showcasing the most important new features. But, at the same time, in every release, there are small features that nobody talks about (usually because it has a narrow usage). One such feature is HTTP trailers. Despite that support for them has been introduced in ASP.NET Core 2.2, you won't find too many mentions about it.
Trailers are part of the HTTP standard since 1.1, yet they've never truly become popular. The idea behind them is quite interesting - to allow sending headers after the body has already been sent. The problem is implementation. In HTTP/1.1 trailers need to be sent after the last chunk of the chunked-encoded response. That's what prevented their adoption. In HTTP/2 things have changed. In HTTP/2 there is an option to send one optional HEADER frame after the last DATA frame. This makes trailers implementation a lot less problematic.
As I've already mentioned, the support for trailers in ASP.NET Core has been introduced in version 2.2 - together with support for HTTP/2. In fact, trailers in ASP.NET Core are supported only for HTTP/2 (which makes perfect sense in the context of the introduction above). How to use the API? The best, as usual, is to show it through an example. There is one modern Web API, which explicitly mentions the possibility of using trailers - Server Timing API. As I've already published a post about Server Timing API in ASP.NET Core, trying to add trailers support to that implementation might be a very good example.
The main cha
noreply@blogger.com (Tomasz Pęczek)