MCPcopy
hub / github.com/github/github-mcp-server / relaxedParseBool

Function relaxedParseBool

pkg/http/middleware/request_config.go:60–64  ·  view source on GitHub ↗

relaxedParseBool parses a string into a boolean value, treating various common false values or empty strings as false, and everything else as true. It is case-insensitive and trims whitespace.

(s string)

Source from the content-addressed store, hash-verified

58// common false values or empty strings as false, and everything else as true.
59// It is case-insensitive and trims whitespace.
60func relaxedParseBool(s string) bool {
61 s = strings.TrimSpace(strings.ToLower(s))
62 falseValues := []string{"", "false", "0", "no", "off", "n", "f"}
63 return !slices.Contains(falseValues, s)
64}

Callers 1

WithRequestConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected