Crow  1.0
A C++ microframework for the web
crow::CORSHandler Struct Reference

CORSHandler is a global middleware for setting CORS headers. More...

Collaboration diagram for crow::CORSHandler:

Classes

struct  context
 

Public Member Functions

void before_handle (crow::request &, crow::response &, context &)
 
void after_handle (crow::request &req, crow::response &res, context &)
 
CORSRulesprefix (const std::string &prefix)
 Handle CORS on a specific prefix path. More...
 
CORSRulesblueprint (const Blueprint &bp)
 Handle CORS for a specific blueprint. More...
 
CORSRulesglobal ()
 Get the global CORS policy. More...
 

Private Member Functions

CORSRulesfind_rule (const std::string &path)
 

Private Attributes

std::vector< std::pair< std::string, CORSRules > > rules
 
CORSRules default_ = CORSRules(this)
 

Detailed Description

CORSHandler is a global middleware for setting CORS headers.

By default, it sets Access-Control-Allow-Origin/Methods/Headers to "*". The default behaviour can be changed with the global() cors rule. Additional rules for prexies can be added with prefix().

Member Function Documentation

◆ before_handle()

void crow::CORSHandler::before_handle ( crow::request ,
crow::response ,
context  
)
inline

◆ after_handle()

void crow::CORSHandler::after_handle ( crow::request req,
crow::response res,
context  
)
inline
Here is the call graph for this function:

◆ prefix()

CORSRules& crow::CORSHandler::prefix ( const std::string &  prefix)
inline

Handle CORS on a specific prefix path.

Here is the caller graph for this function:

◆ blueprint()

CORSRules& crow::CORSHandler::blueprint ( const Blueprint bp)
inline

Handle CORS for a specific blueprint.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ global()

CORSRules& crow::CORSHandler::global ( )
inline

Get the global CORS policy.

Here is the caller graph for this function:

◆ find_rule()

CORSRules& crow::CORSHandler::find_rule ( const std::string &  path)
inlineprivate
Here is the caller graph for this function:

Member Data Documentation

◆ rules

std::vector<std::pair<std::string, CORSRules> > crow::CORSHandler::rules
private

◆ default_

CORSRules crow::CORSHandler::default_ = CORSRules(this)
private

The documentation for this struct was generated from the following file: