看板 Soft_Job 關於我們 聯絡資訊
想幫我的api裝timeoutfittle(查詢超過幾秒就先回傳給user) 下面是我的code https://pastebin.com/8nVcwLQJ 但去打api的時候會跳 [GIN-debug] [WARNING] Headers were already written. Wanted to override status code 504 with 200 panic: http: wrote more than the declared Content-Length 然後軟體就crash了 請問是我timeoutFilterV3那邊有問題嗎 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.34.35.125 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1572588781.A.5BD.html
ddoll288: header送兩次爆炸了,看是要正常結束或是改用websocket 11/01 16:02
anotherday: 基本上改成這樣就通了 https://pastebin.com/Ft6ecTeh 11/01 16:26
anotherday: 不過這樣會永遠送timeout出來就是了 11/01 16:27
anotherday: 覺得你timeout處理應該放在endpoint而不是middleware 11/01 16:38
MOONY135: 請問正常結束要怎樣做(?) 11/01 16:52
rog43: https://github.com/gin-gonic/gin/issues/471 參考看看 11/01 17:47
MOONY135: 有看到這篇 這樣是用stxml的方法處理會比較好嗎 11/01 17:52
MOONY135: 拉到最下面還有另外一種解法 我來試試看 11/01 17:57
rog43: 你可以看看 montanaflynn 那篇回應 11/01 17:57
MOONY135: 感恩 11/01 17:57
GGFACE: 感恩 11/01 17:58