FastAPI: 请求Header&Cookie(9) Posted on 2021-10-02 | In FastAPI | | Header请求自定义Header。 123@app.get('/users/')def root(user_agent: Optional[str] = Header(None)): return {'User-Agent': user_agent} Cookie1234@app.get('/users/')def root(user_agent: Optional[str] = Header(None), sid: Optional[str] = Cookie(None)): return {'User-Agent': user_agent}, {'sid': sid} 欢迎您扫一扫上面的微信公众号,订阅我的博客! 分享创造价值,您的支持将鼓励我继续前行! Donate WeChat Pay Alipay Post author: 唐胡璐 Post link: http://izheyi.com/2021/10/02/FastAPI-请求Header-Cookie(9)/ Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.