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

Function ParseRawQuery

testing/rest.go:118–133  ·  view source on GitHub ↗

ParseRawQuery returns a slice of QueryItems extracted from the raw query string. The parsed QueryItems preserve escaping of key and values. All + escape characters are replaced with %20 for consistent escaping pattern.

(rawQuery string)

Source from the content-addressed store, hash-verified

116// All + escape characters are replaced with %20 for consistent escaping
117// pattern.
118func ParseRawQuery(rawQuery string) (items []QueryItem) {
119 for _, item := range strings.Split(rawQuery, `&`) {
120 parts := strings.SplitN(item, `=`, 2)
121 var value string
122 if len(parts) > 1 {
123 value = parts[1]
124 }
125 items = append(items, QueryItem{
126 // Go Query encoder escapes space as `+` whereas smithy protocol
127 // tests expect `%20`.
128 Key: strings.ReplaceAll(parts[0], `+`, `%20`),
129 Value: strings.ReplaceAll(value, `+`, `%20`),
130 })
131 }
132 return items
133}
134
135// HasQuery validates that the expected set of query items are present in
136// the actual set. Returns an error if any of the expected set are not found in

Callers 1

parseFormBodyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected