highlightBody

fun highlightBody(body: String, contentType: ContentType, useColor: Boolean = isColorSupported()): String(source)

Applies ANSI color highlighting to an HTTP body string based on its content type.

Return

The highlighted body string with ANSI color codes.

Parameters

body

The HTTP body content to highlight.

contentType

The content type of the body.


fun highlightBody(body: JsonElement, useColor: Boolean = isColorSupported()): String(source)

Applies ANSI color highlighting to a JsonElement for terminal output.

Produces pretty-printed output by walking the element tree directly — no intermediate JSON string, no heuristic scanning.

Return

The highlighted JSON string.

Parameters

body

The JsonElement to highlight.

useColor

Whether to apply ANSI color codes.