HTTPConnection class¶
When you want to define dependencies that should be compatible with both HTTP and WebSockets, you can define a parameter that takes anHTTPConnection instead of aRequest or aWebSocket.
You can import it fromfastapi.requests:
fromfastapi.requestsimportHTTPConnectionfastapi.requests.HTTPConnection¶
HTTPConnection(scope,receive=None) Bases:Mapping[str,Any],Generic[StateT]
A base class for incoming HTTP connections, that is used to provideany functionality that is common to bothRequest andWebSocket.
Source code instarlette/requests.py
858687 | |
scopeinstance-attribute¶
scope=scopeappproperty¶
appurlproperty¶
urlbase_urlproperty¶
base_urlheadersproperty¶
headersquery_paramsproperty¶
query_paramspath_paramsproperty¶
path_paramscookiesproperty¶
cookiesclientproperty¶
clientsessionproperty¶
sessionauthproperty¶
authuserproperty¶
userstateproperty¶
stateurl_for¶
url_for(name,/,**path_params)Source code instarlette/requests.py
192193194195196197 | |







