Instance Method
string(max:)
The body decoded as UTF-8, collecting a streaming body first if nothing has collected it yet.
func string(max: BodySizeLimit = .default) async throws -> String?
Parameters
maxThe most bytes to buffer, as
collect(max:).nilbuffers whatever the body produces.
Return Value
The body decoded as UTF-8, or nil if the body is empty.
Discussion
The collecting counterpart to string. See data(max:) for the semantics; this decodes the result, substituting U+FFFD for any invalid UTF-8 rather than failing.
Throws
Abort with .contentTooLarge if a streaming body exceeds max.