fix: some api bug
This commit is contained in:
@@ -64,6 +64,14 @@ func RequestIDFrom(c context.Context) (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func RIdFrom(c context.Context) (string, error) {
|
||||
if rid, ok := c.Value("rid").(string); !ok {
|
||||
return "", errors.New("rid not found in context")
|
||||
} else {
|
||||
return rid, nil
|
||||
}
|
||||
}
|
||||
|
||||
func WithIsAdmin(c context.Context, isAdmin bool) context.Context {
|
||||
return context.WithValue(c, "is_admin", isAdmin)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user