MCPcopy Index your code
hub / github.com/apache/answer / GetEnableShortID

Function GetEnableShortID

internal/base/handler/short_id.go:30–47  ·  view source on GitHub ↗

GetEnableShortID get short id flag from context

(ctx context.Context)

Source from the content-addressed store, hash-verified

28
29// GetEnableShortID get short id flag from context
30func GetEnableShortID(ctx context.Context) bool {
31 // Check gin context first (set by ShortIDMiddleware via ctx.Set)
32 if ginCtx, ok := ctx.(*gin.Context); ok {
33 flag, ok := ginCtx.Get(constant.ShortIDFlag)
34 if ok {
35 if flag, ok := flag.(bool); ok {
36 return flag
37 }
38 return false
39 }
40 }
41 // Fallback for non-gin contexts (e.g., SitemapCron uses context.WithValue)
42 flag, ok := ctx.Value(constant.ShortIDContextKey).(bool)
43 if ok {
44 return flag
45 }
46 return false
47}

Callers 15

GetQuestionMethod · 0.92
GetObjectTimelineMethod · 0.92
ShowFormatMethod · 0.92
parseItemMethod · 0.92
AdminSearchListMethod · 0.92
SearchObjectCollectedMethod · 0.92
parseResultMethod · 0.92
AddAnswerMethod · 0.92
GetAnswerMethod · 0.92
GetAnswerListMethod · 0.92

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected