Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 1,406 for cdef (0.16 sec)

  1. tests/test_tutorial/test_websockets/test_tutorial002_py310.py

    
    @pytest.fixture(name="app")
    def get_app():
        from docs_src.websockets.tutorial002_py310 import app
    
        return app
    
    
    @needs_py310
    def test_main(app: FastAPI):
        client = TestClient(app)
        response = client.get("/")
        assert response.status_code == 200, response.text
        assert b"<!DOCTYPE html>" in response.content
    
    
    @needs_py310
    def test_websocket_with_cookie(app: FastAPI):
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  2. docs_src/custom_request_and_route/tutorial003.py

    from typing import Callable
    
    from fastapi import APIRouter, FastAPI, Request, Response
    from fastapi.routing import APIRoute
    
    
    class TimedRoute(APIRoute):
        def get_route_handler(self) -> Callable:
            original_route_handler = super().get_route_handler()
    
            async def custom_route_handler(request: Request) -> Response:
                before = time.time()
                response: Response = await original_route_handler(request)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 1K bytes
    - Viewed (0)
  3. tests/test_router_redirect_slashes.py

    from fastapi import APIRouter, FastAPI
    from fastapi.testclient import TestClient
    
    
    def test_redirect_slashes_enabled():
        app = FastAPI()
        router = APIRouter()
    
        @router.get("/hello/")
        def hello_page() -> str:
            return "Hello, World!"
    
        app.include_router(router)
    
        client = TestClient(app)
    
        response = client.get("/hello/", follow_redirects=False)
        assert response.status_code == 200
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Jun 22 10:37:50 GMT 2023
    - 974 bytes
    - Viewed (0)
  4. tests/test_security_http_bearer_description.py

    app = FastAPI()
    
    security = HTTPBearer(description="HTTP Bearer token scheme")
    
    
    @app.get("/users/me")
    def read_current_user(credentials: HTTPAuthorizationCredentials = Security(security)):
        return {"scheme": credentials.scheme, "credentials": credentials.credentials}
    
    
    client = TestClient(app)
    
    
    def test_security_http_bearer():
        response = client.get("/users/me", headers={"Authorization": "Bearer foobar"})
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  5. tests/test_security_http_digest_description.py

    app = FastAPI()
    
    security = HTTPDigest(description="HTTPDigest scheme")
    
    
    @app.get("/users/me")
    def read_current_user(credentials: HTTPAuthorizationCredentials = Security(security)):
        return {"scheme": credentials.scheme, "credentials": credentials.credentials}
    
    
    client = TestClient(app)
    
    
    def test_security_http_digest():
        response = client.get("/users/me", headers={"Authorization": "Digest foobar"})
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  6. tests/test_serialize_response_dataclass.py

    
    @app.get("/items/valid", response_model=Item)
    def get_valid():
        return {"name": "valid", "date": datetime(2021, 7, 26), "price": 1.0}
    
    
    @app.get("/items/object", response_model=Item)
    def get_object():
        return Item(
            name="object", date=datetime(2021, 7, 26), price=1.0, owner_ids=[1, 2, 3]
        )
    
    
    @app.get("/items/coerce", response_model=Item)
    def get_coerce():
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Aug 26 13:56:47 GMT 2022
    - 4.9K bytes
    - Viewed (0)
  7. tests/test_custom_route_class.py

    router_a = APIRouter(route_class=APIRouteA)
    router_b = APIRouter(route_class=APIRouteB)
    router_c = APIRouter(route_class=APIRouteC)
    
    
    @router_a.get("/")
    def get_a():
        return {"msg": "A"}
    
    
    @router_b.get("/")
    def get_b():
        return {"msg": "B"}
    
    
    @router_c.get("/")
    def get_c():
        return {"msg": "C"}
    
    
    router_b.include_router(router=router_c, prefix="/c")
    router_a.include_router(router=router_b, prefix="/b")
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  8. tests/main.py

    def get_str_id(item_id: str):
        return item_id
    
    
    @app.get("/path/int/{item_id}")
    def get_int_id(item_id: int):
        return item_id
    
    
    @app.get("/path/float/{item_id}")
    def get_float_id(item_id: float):
        return item_id
    
    
    @app.get("/path/bool/{item_id}")
    def get_bool_id(item_id: bool):
        return item_id
    
    
    @app.get("/path/param/{item_id}")
    def get_path_param_id(item_id: Optional[str] = Path()):
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 4.3K bytes
    - Viewed (0)
  9. build-logic/documentation/src/test/groovy/gradlebuild/docs/model/SimpleClassMetaDataRepositoryTest.groovy

        def canAddMetaData() {
            TestDomainObject value = new TestDomainObject('a')
    
            when:
            repository.put('class', value)
    
            then:
            repository.find('class') == value
            repository.get('class') == value
        }
    
        def findReturnsNullForUnknownClass() {
            expect:
            repository.find('unknown') == null
    Groovy
    - Registered: Wed Apr 17 11:36:08 GMT 2024
    - Last Modified: Sat Apr 06 02:21:33 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  10. build-logic/documentation/src/test/groovy/gradlebuild/docs/dsl/docbook/ClassDocPropertiesBuilderTest.groovy

            return doc
        }
    
        def property(String name, ClassMetaData classMetaData) {
            return property([:], name, classMetaData)
        }
    
        def property(Map<String, ?> args, String name, ClassMetaData classMetaData) {
            PropertyMetaData property = Mock()
            _ * property.name >> name
            _ * property.ownerClass >> classMetaData
    Groovy
    - Registered: Wed Apr 17 11:36:08 GMT 2024
    - Last Modified: Wed Dec 09 08:14:05 GMT 2020
    - 7.6K bytes
    - Viewed (0)
Back to top