Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 1,030 for posAt (0.04 sec)

  1. docs_src/request_files/tutorial002_an_py39.py

    from typing import Annotated
    
    from fastapi import FastAPI, File, UploadFile
    from fastapi.responses import HTMLResponse
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_files(files: Annotated[list[bytes], File()]):
        return {"file_sizes": [len(file) for file in files]}
    
    
    @app.post("/uploadfiles/")
    async def create_upload_files(files: list[UploadFile]):
        return {"filenames": [file.filename for file in files]}
    
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 826 bytes
    - Viewed (0)
  2. tests/test_tutorial/test_request_files/test_tutorial001_02_an_py39.py

        return client
    
    
    @needs_py39
    def test_post_form_no_body(client: TestClient):
        response = client.post("/files/")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "No file sent"}
    
    
    @needs_py39
    def test_post_uploadfile_no_body(client: TestClient):
        response = client.post("/uploadfile/")
        assert response.status_code == 200, response.text
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 8.5K bytes
    - Viewed (0)
  3. src/net/http/requestwrite_test.go

    			"\r\n" +
    			"abcdef",
    	},
    
    	// HTTP/1.1 POST with Content-Length in headers
    	4: {
    		Req: Request{
    			Method: "POST",
    			URL:    mustParseURL("http://example.com/"),
    			Host:   "example.com",
    			Header: Header{
    				"Content-Length": []string{"10"}, // ignored
    			},
    			ContentLength: 6,
    		},
    
    		Body: []byte("abcdef"),
    
    		WantWrite: "POST / HTTP/1.1\r\n" +
    			"Host: example.com\r\n" +
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 07 01:07:32 UTC 2022
    - 23.3K bytes
    - Viewed (0)
  4. tests/test_additional_properties_bool.py

        pass
    
    
    app = FastAPI()
    
    
    @app.post("/")
    async def post(
        foo: Union[Foo, None] = None,
    ):
        return foo
    
    
    client = TestClient(app)
    
    
    def test_call_invalid():
        response = client.post("/", json={"foo": {"bar": "baz"}})
        assert response.status_code == 422
    
    
    def test_call_valid():
        response = client.post("/", json={})
        assert response.status_code == 200
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 4.2K bytes
    - Viewed (0)
  5. pkg/config/analysis/analyzers/testdata/authorizationpolicies.yaml

            - source:
                namespaces: ["httpbin"] # Namespace exists
          to:
            - operation:
                methods: ["GET"]
                paths: ["/info*"]
            - operation:
                methods: ["POST"]
                paths: ["/data"]
          when:
            - key: request.auth.claims[iss]
              values: ["https://accounts.google.com"]
    ---
    apiVersion: security.istio.io/v1beta1
    kind: AuthorizationPolicy
    metadata:
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Mar 08 14:14:46 UTC 2023
    - 7.8K bytes
    - Viewed (0)
  6. tests/test_union_body.py

    class Item(BaseModel):
        name: Optional[str] = None
    
    
    class OtherItem(BaseModel):
        price: int
    
    
    @app.post("/items/")
    def save_union_body(item: Union[OtherItem, Item]):
        return {"item": item}
    
    
    client = TestClient(app)
    
    
    def test_post_other_item():
        response = client.post("/items/", json={"price": 100})
        assert response.status_code == 200, response.text
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 4.6K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_request_files/test_tutorial002_an.py

    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from docs_src.request_files.tutorial002_an import app
    
    client = TestClient(app)
    
    
    def test_post_form_no_body():
        response = client.post("/files/")
        assert response.status_code == 422, response.text
        assert response.json() == IsDict(
            {
                "detail": [
                    {
                        "type": "missing",
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Thu Apr 18 19:40:57 UTC 2024
    - 8.5K bytes
    - Viewed (0)
  8. tests/test_modules_same_name_body/test_main.py

    client = TestClient(app)
    
    
    def test_post_a():
        data = {"a": 2, "b": "foo"}
        response = client.post("/a/compute", json=data)
        assert response.status_code == 200, response.text
        data = response.json()
    
    
    def test_post_a_invalid():
        data = {"a": "bar", "b": "foo"}
        response = client.post("/a/compute", json=data)
        assert response.status_code == 422, response.text
    
    
    def test_post_b():
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 5.6K bytes
    - Viewed (0)
  9. docs_src/request_files/tutorial002_an.py

    from fastapi.responses import HTMLResponse
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_files(files: Annotated[List[bytes], File()]):
        return {"file_sizes": [len(file) for file in files]}
    
    
    @app.post("/uploadfiles/")
    async def create_upload_files(files: List[UploadFile]):
        return {"filenames": [file.filename for file in files]}
    
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 861 bytes
    - Viewed (0)
  10. src/net/http/httptest/httptest_test.go

    					HandshakeComplete: true,
    					ServerName:        "foo.com",
    				},
    			},
    			wantBody: "",
    		},
    
    		{
    			name:   "Post with known length",
    			method: "POST",
    			uri:    "/",
    			body:   strings.NewReader("foo"),
    			want: &http.Request{
    				Method:        "POST",
    				Host:          "example.com",
    				URL:           &url.URL{Path: "/"},
    				Header:        http.Header{},
    				Proto:         "HTTP/1.1",
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 11 18:09:14 UTC 2024
    - 4.6K bytes
    - Viewed (0)
Back to top