Little Known ASP.NET Core Features - HTTP Trailers

8 wrz 2020 | Blog | asp.net core | server timing | trailers | 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.

What Are Trailers?

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.

Trailers Support in ASP.NET Core

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

POSTY TEGO AUTORA

Monitoring C# Azure Functions in the Isolated Worker Model - Infrastructure & Configuration Deep Dive26 lis 2024

Blog | programowanie | .net | c# | azure functions | IT

ASP.NET Core 9 and IAsyncEnumerable - Async Streaming JSON and NDJSON From Blazor WebAssembly24 wrz 2024

Blog | programowanie | .net | c# | asp.net core | blazor | IT

Azure Functions Extensibility - Extensions and Isolated Worker Model5 mar 2024

Blog | programowanie | .net | c# | azure functions | azure | IT

Azure Functions Extensibility - Runtime Scaling22 lut 2024

Blog | programowanie | .net | c# | azure | IT

Yet Another Developer Blog

noreply@blogger.com (Tomasz Pęczek)