Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add context field to HTTPServerRequest #1550

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions source/vibe/http/server.d
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,20 @@ final class HTTPServerRequest : HTTPRequest {
*/
DictionaryList!(string, true, 8) params;

import std.variant : Variant;
/** A map of context items for the request.

This is especially useful for passing application specific data down
the chain of processors along with the request itself.

For example, a generic route may be defined to check user login status,
if the user is logged in, add a reference to user specific data to the
context.

This is implemented with std.variant.Variant to allow any type of data.
*/
Variant[string] context;

/** Supplies the request body as a stream.

Note that when certain server options are set (such as
Expand Down