MCPcopy
hub / github.com/encode/starlette / get

Method get

tests/test_endpoints.py:15–19  ·  tests/test_endpoints.py::Homepage.get
(self, request: Request)

Source from the content-addressed store, hash-verified

13
14class Homepage(HTTPEndpoint):
15 async def get(self, request: Request) -> PlainTextResponse:
16 username = request.path_params.get(class="st">"username")
17 if username is None:
18 return PlainTextResponse(class="st">"Hello, world!")
19 return PlainTextResponse(fclass="st">"Hello, {username}!")
20
21
22app = Router(routes=[Route(class="st">"/", endpoint=Homepage), Route(class="st">"/{username}", endpoint=Homepage)])

Callers 15

test_request_urlFunction · 0.45
test_request_headersFunction · 0.45
test_request_bodyFunction · 0.45
test_request_streamFunction · 0.45
test_request_raw_pathFunction · 0.45
test_request_stateFunction · 0.45
appFunction · 0.45
test_request_cookiesFunction · 0.45
test_cookies_edge_casesFunction · 0.45
test_cookies_invalidFunction · 0.45

Calls 1

PlainTextResponseClass · 0.90

Tested by

no test coverage detected