Session.endpoint(route, *, method=‘GET’)
Create a custom endpoint atf"/proxy/{route}".
Calling this method overrides
atoti.Session.proxy’s url.- take three parameters with respective types:
- return a response body as JSON convertible data
-
Parameters:
- route (str) – The template of the path after
"/proxy". For instance, if"foo/bar"is passed, a request to"/proxy/foo/bar?query=string"will match. Path parameters can be configured by wrapping their name in curly braces in the template. - method (Literal [ ‘DELETE’ , ‘GET’ , ‘PATCH’ , ‘POST’ , ‘PUT’ ]) – The HTTP method the request must be using to trigger this endpoint.
DELETE,PATCH,POST, andPUTrequests can have a body but it must be JSON.
- route (str) – The template of the path after
- Return type: Callable[[Callable[[Request, User, Session], JsonValue]], Callable[[Request, User, Session], JsonValue]]
Example
See also:
atoti.Session.proxy.