国产chinesehdxxxx野外,国产av无码专区亚洲av琪琪,播放男人添女人下边视频,成人国产精品一区二区免费看,chinese丰满人妻videos

HTTP

2019-04-02 11:43 更新

介紹

http庫(kù)無需初始化, 導(dǎo)入后直接使用.

http.ok()

此方法在使用httpd對(duì)象注冊(cè)了before處理方法之后, 可以直接return http.ok().

當(dāng)before函數(shù)正確檢測(cè)到返回http.ok()后, 允許當(dāng)前路由繼續(xù)執(zhí)行到用戶回調(diào)函數(shù)(類).

http.redirect(url, code)

此方法在使用httpd對(duì)象注冊(cè)了before處理方法之后, 可以直接return http.redirect(your url).

當(dāng)before函數(shù)正確檢測(cè)到返回http.redirect()后, 將會(huì)任務(wù)將請(qǐng)求重定向到其它http[s]鏈接上.

第二個(gè)參數(shù)code為可選的http跳轉(zhuǎn)碼, 只能是301302(不傳入code默認(rèn)情況下是302);

http.throw(code, html)

此方法在使用httpd對(duì)象注冊(cè)了before處理方法之后, 可以直接return http.throw(code, html).

當(dāng)before函數(shù)正確檢測(cè)到返回http.throw()后, 將會(huì)使用指定的code狀態(tài)碼來進(jìn)行返回(僅允許400-499之間的錯(cuò)誤碼);

第二個(gè)參數(shù)為可選的html代碼, 作為自定義錯(cuò)誤碼的內(nèi)容(可以在調(diào)試階段將錯(cuò)誤日志打印出來).

使用示例

app:before(function (content)
    if true then
        return http.ok()
    end
    if true then
        return http.redirect('https://github.com/CandyMi/core_framework')
        -- return http.redirect('https://github.com/CandyMi/core_framework', 301 or 302)
    end
    if true then
        return http.throw(431, '<h1> This is 413 Error, too long request header</h1>')
    end
end)
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)