Hiding context within a request

A third clever mechanism for passing contextual state to handlers from the web application framework or middleware is to hide the context within the request itself. Since the request contains dynamic map information such as request headers and form key/value pairs, it is fairly easy to embed new information into this existing structure.

A good example of this is the Vestigo URL Router: https://github.com/husobee/vestigo. This standalone URL router actually hides the request URL parameter names and values within form fields on the request structure itself. This allows the developer to access the contextual framework's supplied information, in this case, the URL parameter names and values, without the need to ...

Get Echo Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.