MCPcopy Create free account
hub / github.com/aws/smithy-go / EscapePath

Function EscapePath

encoding/httpbinding/path_replace.go:82–93  ·  view source on GitHub ↗

EscapePath escapes part of a URL path in Amazon style.

(path string, encodeSep bool)

Source from the content-addressed store, hash-verified

80
81// EscapePath escapes part of a URL path in Amazon style.
82func EscapePath(path string, encodeSep bool) string {
83 var buf bytes.Buffer
84 for i := 0; i < len(path); i++ {
85 c := path[i]
86 if noEscape[c] || (c == '/' && !encodeSep) {
87 buf.WriteByte(c)
88 } else {
89 fmt.Fprintf(&buf, "%%%02X", c)
90 }
91 }
92 return buf.String()
93}
94
95var noEscape [256]bool
96

Callers 1

replacePathElementFunction · 0.85

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected