Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 5,425 for code (0.16 sec)

  1. tests/test_response_change_status_code.py

        response.status_code = 201
    
    
    async def parent_dep(result=Depends(response_status_setter)):
        return result
    
    
    @app.get("/", dependencies=[Depends(parent_dep)])
    async def get_main():
        return {"msg": "Hello World"}
    
    
    client = TestClient(app)
    
    
    def test_dependency_set_status_code():
        response = client.get("/")
        assert response.status_code == 201, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Apr 08 04:37:38 GMT 2020
    - 589 bytes
    - Viewed (0)
  2. tests/test_security_oauth2_authorization_code_bearer.py

    
    def test_no_token():
        response = client.get("/items")
        assert response.status_code == 401, response.text
        assert response.json() == {"detail": "Not authenticated"}
    
    
    def test_incorrect_token():
        response = client.get("/items", headers={"Authorization": "Non-existent testtoken"})
        assert response.status_code == 401, response.text
        assert response.json() == {"detail": "Not authenticated"}
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.3K bytes
    - Viewed (0)
  3. tests/test_reponse_set_reponse_code_empty.py

    
    @app.delete(
        "/{id}",
        status_code=204,
        response_model=None,
    )
    async def delete_deployment(
        id: int,
        response: Response,
    ) -> Any:
        response.status_code = 400
        return {"msg": "Status overwritten", "id": id}
    
    
    client = TestClient(app)
    
    
    def test_dependency_set_status_code():
        response = client.delete("/1")
        assert response.status_code == 400 and response.content
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  4. tests/test_security_oauth2_authorization_code_bearer_description.py

        tokenUrl="token",
        description="OAuth2 Code Bearer",
        auto_error=True,
    )
    
    
    @app.get("/items/")
    async def read_items(token: Optional[str] = Security(oauth2_scheme)):
        return {"token": token}
    
    
    client = TestClient(app)
    
    
    def test_no_token():
        response = client.get("/items")
        assert response.status_code == 401, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.4K bytes
    - Viewed (0)
  5. docs/fr/docs/advanced/additional-status-codes.md

    # Codes HTTP supplémentaires
    
    Par défaut, **FastAPI** renverra les réponses à l'aide d'une structure de données `JSONResponse`, en plaçant la réponse de votre  *chemin d'accès* à l'intérieur de cette `JSONResponse`.
    
    Il utilisera le code HTTP par défaut ou celui que vous avez défini dans votre *chemin d'accès*.
    
    ## Codes HTTP supplémentaires
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 2.3K bytes
    - Viewed (0)
  6. docs/en/docs/advanced/additional-status-codes.md

    For example, let's say that you want to have a *path operation* that allows to update items, and returns HTTP status codes of 200 "OK" when successful.
    
    But you also want it to accept new items. And when the items didn't exist before, it creates them, and returns an HTTP status code of 201 "Created".
    
    To achieve that, import `JSONResponse`, and return your content there directly, setting the `status_code` that you want:
    
    === "Python 3.10+"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 2.6K bytes
    - Viewed (0)
  7. api/maven-api-core/src/main/java/org/apache/maven/api/Node.java

        /**
         * Traverses this node and potentially its children using the specified visitor.
         *
         * @param visitor the visitor to call back, must not be {@code null}
         * @return {@code true} to visit siblings nodes of this node as well, {@code false} to skip siblings
         */
        boolean accept(@Nonnull NodeVisitor visitor);
    
        /**
         * Returns a new tree starting at this node, filtering the children.
    Java
    - Registered: Sun Apr 28 03:35:10 GMT 2024
    - Last Modified: Fri Dec 08 08:42:44 GMT 2023
    - 3.2K bytes
    - Viewed (0)
  8. maven-core/src/test/resources/apiv4-repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar

    the examined object is logically equal to the specified * <code>operand</code>, as determined by calling the {@link java.lang.Object#equals} method on * the <b>examined</b> object. * * <p>If the specified operand is <code>null</code> then the created matcher will only match if * the examined object's <code>equals</code> method returns <code>true</code> when passed a * <code>null</code> (which would be a violation of the <code>equals</code> contract), unless the * examined object itself is <code>null</code>,...
    Archive
    - Registered: Sun Apr 14 03:35:08 GMT 2024
    - Last Modified: Sun Oct 02 08:41:25 GMT 2022
    - 31.9K bytes
    - Viewed (0)
  9. misc/wasm/wasm_exec_node.js

    go.exit = process.exit;
    WebAssembly.instantiate(fs.readFileSync(process.argv[2]), go.importObject).then((result) => {
    	process.on("exit", (code) => { // Node.js exits if no event handler is pending
    		if (code === 0 && !go.exited) {
    			// deadlock, make Go print error and stack traces
    			go._pendingEvent = { id: 0 };
    			go._resume();
    		}
    	});
    	return go.run(result.instance);
    JavaScript
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Mon Jan 30 18:49:42 GMT 2023
    - 1.1K bytes
    - Viewed (0)
  10. docs/de/docs/advanced/additional-status-codes.md

    === "Python 3.10+"
    
        ```Python hl_lines="4  25"
        {!> ../../../docs_src/additional_status_codes/tutorial001_an_py310.py!}
        ```
    
    === "Python 3.9+"
    
        ```Python hl_lines="4  25"
        {!> ../../../docs_src/additional_status_codes/tutorial001_an_py39.py!}
        ```
    
    === "Python 3.8+"
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 23 13:04:57 GMT 2024
    - 3K bytes
    - Viewed (0)
Back to top