res.type(mime.lookup(path)) -> res is a type of express.Response
res.setHeader('Content-Type', mime.lookup(path))
我能知道上面兩條線是一樣的嗎?
uj5u.com熱心網友回復:
是的,它具有相同的功能來設定Content-Type回應標頭。
這里的檔案res.type
https://expressjs.com/en/api.html#res.type
這里的檔案res.set
https://expressjs.com/en/api.html#res.set
uj5u.com熱心網友回復:
您可以通過從客戶端呼叫 api 或使用登錄服務器進行測驗,查看更多View Express JS 回應標頭?
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/428887.html
標籤:表示
上一篇:如何顯示后端錯誤訊息而不是狀態碼
