that's my code idk what should i put in view
TypeError: Failed to execute 'fetch' on 'Window': 'TRACE' HTTP method is unsupported.
from fastapi import FastAPI
app = FastAPI()
@app.trace("/")
def test_trace():
...
CodePudding user response:
That's not a problem with your code but the browser. The TRACE HTTP method has little to no support on browsers according to MDN. And since the swagger UI page for FastAPI uses the browser to make these API calls, it may not work.
However your code is working as expected. You can check that by using curl:
(venv) ➜ curl -X TRACE http://127.0.0.1:8000
"test"% (venv) ➜
From the handler method:
@app.trace("/")
def test_trace():
return "test"