{#each [['pretty', 'Pretty'], ['raw', 'Raw'], ['preview', 'Preview'], ['diff', 'Diff']] as [id, label]} {#if id !== 'preview' || kind === 'html' || kind === 'image' || kind === 'pdf'} {#if id !== 'diff' || hasPrevious}
(mode = id as Mode)}>{label}
{/if} {/if} {/each}
{#if kind === 'json' && mode === 'pretty' && tree}
{ if (e.key === 'Enter') viewer?.nextHit(e.shiftKey ? -1 : 1); if (e.key === 'Escape') query = ''; }} /> {#if query && !isPath && viewer}
{viewer.hitCount()}
{/if}
viewer?.expandAll(true)} title="Expand all">+
viewer?.expandAll(false)} title="Collapse all">−
{:else if mode === 'raw' || (mode === 'pretty' && kind !== 'json')}
(wrap = !wrap)}>Wrap
{/if}
{#if tooLarge}
The body is {formatBytes(resp.size)}, more than knock keeps in memory. It was written to
{resp.body_file}
; the first megabyte is shown. Use the save button for the full file.
{/if}
{#if text === undefined || (parsing && kind === 'json' && mode !== 'raw')}
Loading body…
{:else if resp.size === 0}
The response has no body.
{:else if mode === 'diff' && tab.previous}
{:else if mode === 'preview'} {#if kind === 'image' && blobUrl}
{:else if kind === 'pdf' && blobUrl}
{:else if kind === 'html'}
{/if} {:else if mode === 'pretty' && kind === 'json' && tree} {#if isPath} {#if filtered.error}
{filtered.error}
{:else if filtered.node}
{/if} {:else}
{/if} {:else if kind === 'binary' && mode !== 'raw'}
Binary content ({resp.content_type ?? 'unknown type'}, {formatBytes(resp.size)}).
(mode = 'raw')}>Show as text
{:else} {#key `${mode}-${wrap}`}
{/key} {/if}