wrap

fun wrap(delegate: HttpTransport, group: String, nameFor: (HttpRequest) -> String? = { null }): HttpTransport(source)

Decorates delegate: every successful response it returns is recorded under <directory>/<group>/.

Return

the decorating transport; close() closes delegate.

Parameters

delegate

the live transport.

group

one or more /-separated directory segments of [A-Za-z0-9._-]+, not . or .. and not ending in ., for example opendota or steam/v2.

nameFor

names the file (one segment of the same rule, without .http) for a request, or returns null for the generated name; the default names nothing. A result that breaks the rule throws IllegalArgumentException from the decorator's execute, after the delegate returned.

Throws

if group breaks the rule.