MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / appendString

Method appendString

logger/formatter_json.go:169–178  ·  view source on GitHub ↗

appendString appends a string value to the buffer. If the string does not require escaping, it is appended directly. Otherwise, it is JSON marshaled.

(val string)

Source from the content-addressed store, hash-verified

167// If the string does not require escaping, it is appended directly.
168// Otherwise, it is JSON marshaled.
169func (s *formatterJSON) appendString(val string) {
170 if !s.isStringSafe(val) {
171 s.appendJSONMarshal(val)
172 return
173 }
174
175 s.buf.append('"')
176 s.buf.appendStringRaw(val)
177 s.buf.append('"')
178}
179
180// isStringSafe checks if a string is safe to append without escaping.
181func (s *formatterJSON) isStringSafe(val string) bool {

Callers 4

formatMethod · 0.95
appendKeyMethod · 0.95
appendValueMethod · 0.95
appendJSONMarshalMethod · 0.95

Calls 4

isStringSafeMethod · 0.95
appendJSONMarshalMethod · 0.95
appendMethod · 0.80
appendStringRawMethod · 0.80

Tested by

no test coverage detected