MCPcopy Index your code
hub / github.com/bugy/script-server / match

Method match

src/tests/utils/mock_server.py:58–83  ·  view source on GitHub ↗
(self, request_handler)

Source from the content-addressed store, hash-verified

56 self.headers = headers
57
58 def match(self, request_handler) -> MatchResult:
59 match_result = MatchResult()
60
61 match_result.add_match_result('method', self.method, request_handler.request.method)
62 match_result.add_match_result(
63 'path',
64 self.path_pattern,
65 request_handler.request.uri,
66 lambda: re.match(self.path_pattern, request_handler.request.uri)
67 )
68
69 if self.request_body:
70 actual_body = request_handler.request.body
71 if actual_body:
72 actual_body = actual_body.decode('utf8')
73 match_result.add_match_result(
74 'body',
75 self.request_body,
76 actual_body)
77
78 if self.headers:
79 for header, value in self.headers.items():
80 actual_value = request_handler.request.headers.get(header)
81 match_result.add_match_result('Header:' + header, value, actual_value)
82
83 return match_result
84
85 def handle(self, request_handler):
86 if self.response_handler:

Callers 6

loadsFunction · 0.80
_pre_3_5_recursive_globFunction · 0.80
has_matchMethod · 0.80
clean_resultsMethod · 0.80
handle_requestMethod · 0.80

Calls 3

add_match_resultMethod · 0.95
MatchResultClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected