MCPcopy Create free account
hub / github.com/Corvusoft/restbed / set_method_handler

Method set_method_handler

src/corvusoft/restbed/resource.cpp:80–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78 }
79
80 void Resource::set_method_handler( const string& method, const function< void ( const shared_ptr< Session > ) >& callback )
81 {
82 if ( method.empty( ) )
83 {
84 throw invalid_argument( "Attempt to set resource handler to an empty protocol method." );
85 }
86
87 if ( callback not_eq nullptr )
88 {
89 m_pimpl->m_methods.insert( method );
90 m_pimpl->m_method_handlers.insert( make_pair( method, callback ) );
91 }
92 }
93}

Calls

no outgoing calls

Tested by

no test coverage detected