Skip to content

You're viewing documentation for a pre-release version. View the latest stable version

Instance Method

string(max:)

The body decoded as UTF-8, collecting the stream first if nothing has collected it yet.
func string(max: BodySizeLimit = .default) async throws -> String?

Parameters

max

The ceiling, as collect(max:).

Return Value

The body decoded as UTF-8, or nil if the request has no body.

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 the body exceeds max.