File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -972,6 +972,21 @@ def clear_all_handlers(self):
972972 self .oneshot_handlers = RequestHandlerList ()
973973 self .handlers = RequestHandlerList ()
974974
975+ def expect (self , matcher : RequestMatcher ) -> RequestHandler :
976+ """
977+ Create and register a request handler.
978+
979+ :param matcher: :py:class:`RequestMatcher` used to match requests.
980+ """
981+ request_handler = RequestHandler (matcher )
982+ if handler_type == HandlerType .PERMANENT :
983+ self .handlers .append (request_handler )
984+ elif handler_type == HandlerType .ONESHOT :
985+ self .oneshot_handlers .append (request_handler )
986+ elif handler_type == HandlerType .ORDERED :
987+ self .ordered_handlers .append (request_handler )
988+ return request_handler
989+
975990 def expect_request (
976991 self ,
977992 uri : str | URIPattern | Pattern [str ],
You can’t perform that action at this time.
0 commit comments