julyclyde

cf worker Python 的问题,到底是否要 async?

  •  
  •   julyclyde · Sep 10, 2024 · 1309 views
    This topic created in 630 days ago, the information mentioned may be changed or developed.
    他们文档的例子是不带 async 的
    from js import Response

    def on_fetch(request):
    return Response.new("Hello World!")

    但如果我要访问 request 对象,因为 request 对象是 awaitable 的,那我的 on_fetch 函数也
    需要加 async

    我的提问是:他们怎么做到同时兼容带有和不带 async 的两种不同的 on_fetch 的?
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4970 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 93c8b4a0 · 43ms · UTC 01:07 · PVG 09:07 · LAX 18:07 · JFK 21:07
    ♥ Do have faith in what you're doing.