Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 2 of 2 for post_form (0.06 seconds)

The search processing time has exceeded the limit. The displayed results may be partial.

  1. tests/test_forms_single_param.py

    from typing import Annotated
    
    from fastapi import FastAPI, Form
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    app = FastAPI()
    
    
    @app.post("/form/")
    def post_form(username: Annotated[str, Form()]):
        return username
    
    
    client = TestClient(app)
    
    
    def test_single_form_field():
        response = client.post("/form/", data={"username": "Rick"})
        assert response.status_code == 200, response.text
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 4.1K bytes
    - Click Count (0)
  2. tests/test_forms_single_model.py

        alias_with: str = Field(alias="with", default="nothing")
    
    
    class FormModelExtraAllow(BaseModel):
        param: str
    
        model_config = {"extra": "allow"}
    
    
    @app.post("/form/")
    def post_form(user: Annotated[FormModel, Form()]):
        return user
    
    
    @app.post("/form-extra-allow/")
    def post_form_extra_allow(params: Annotated[FormModelExtraAllow, Form()]):
        return params
    
    
    client = TestClient(app)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 3.4K bytes
    - Click Count (0)
Back to Top