我已經切換到 Gin 來嘗試一下。在移動之前,我使用這樣的請求對象訪問了 BasicAuth 憑據(app_id 和令牌):appId, token, _ := r.BasicAuth()將app_id要在我的數據庫在每次調用發現的需求,所以我用杜松子酒中間件這樣的:func CheckAppId() gin.HandlerFunc { return func(c *gin.Context) { //how do I access the BasicAuth creds here? }}但我不確定如何在沒有請求對象的情況下訪問 BasicAuth 憑據。
- 1 回答
- 0 關注
- 317 瀏覽
添加回答
舉報
0/150
提交
取消