Your Name 3 سال پیش
والد
کامیت
c5ac86cbb5
1فایلهای تغییر یافته به همراه6 افزوده شده و 4 حذف شده
  1. 6 4
      step_question/apis/main.py

+ 6 - 4
step_question/apis/main.py

@@ -10,6 +10,8 @@ import io
 from starlette.responses import RedirectResponse
 import codecs
 import random
+from starlette.status import HTTP_302_FOUND,HTTP_303_SEE_OTHER
+
 app = FastAPI()
 app.add_middleware(
     CORSMiddleware,
@@ -48,11 +50,11 @@ async def submit(request: Request):
 #    lines=fr.read()
 #    fr.close()
 #    response = RedirectResponse(url='/a1/index_complete.html')
-    lines="""<html><body onload="document.location.replace( '/a1/index_complete.html?par={0}');">
-    </body></html>"""
+#    lines="""<html><body onload="document.location.replace( '/a1/index_complete.html?par={0}');">
+#    </body></html>"""
 #    return RedirectResponse(url='/a1/index_complete.html')
-    return HTMLResponse(content=lines.format(str(random.randint(100000,999999))), status_code=200)
-
+#    return HTMLResponse(content=lines.format(str(random.randint(100000,999999))), status_code=200)
+    return RedirectResponse(url="/a1/index_complete.html", status_code=HTTP_302_FOUND)
 #    return result