Ktor: Altering served content
When serving files with Ktor, there might be times when you need to alter those files. For example, you might want to inject a script in every served HTML file. For this purpose, we can leverage plugins. Plugins can hook at different stages of the request/response pipeline: Ktor request/response pipeline Let’s write a plugin that transforms a specific type of files - going with the previous example of injecting a script to every served HTML file.