June 2017
Intermediate to advanced
400 pages
10h 32m
English
The github.com/unrolled/render package does the heavy lifting for this recipe. There are a huge number of other options you can input if you need to work with HTML templates and more. This recipe can be used to autonegotiate when working through web handlers as is demonstrated here by passing in various content type headers, or directly by manipulating the struct.
A similar pattern can be applied to accept headers, but beware that this header often includes multiple values and your code will have to take that into account.
Read now
Unlock full access