In some situations, developers might need to attach custom headers to requests and responses from your web service APIs. An example of this might be additional information about a resource in the response, such as an expiry date. In this example, we will have a look at adding a custom header to the response via an attribute filter.
If you are using a non-express version of Visual Studio, you can start this recipe using ServiceStackVS and creating a project based on the ServiceStack ASP.NET Empty template. In this example, we are going to use Postman as the client to test and view the custom headers in the response. If you are using an express version of Visual Studio, please follow Creating a ServiceStack solution with Visual Studio and NuGet in Appendix A, Getting Started and start from the third instruction in the following How to do it... section.