HTTP Archive

/views/vhar/Response.html (2.1 KB)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{% import (
"fmt"
"strings"

"{{{ .Package }}}/app/controller/cutil"
"{{{ .Package }}}/app/lib/har"
"{{{ .Package }}}/app/util"
) %}

{% func RenderResponse(key string, r *har.Response, ps *cutil.PageState) %}
<div class="overflow full-width">
<table class="min-200 expanded">
<tbody>
<tr>
<th class="shrink">Status</th>
<td>{%d r.Status %}: {%s r.StatusText %}</td>
</tr>
{%- if r.RedirectURL != "" -%}
<tr>
<th class="shrink">Redirect URL</th>
<td>{%s r.RedirectURL %}</td>
</tr>
{%- endif -%}
<tr>
<th class="shrink">Headers </th>
<td>{%= renderNVPsHidden(fmt.Sprintf("response-header-%s", key), "Header", r.Headers, r.HeadersSize, ps) %}</td>
</tr>
{%- if len(r.Cookies) > 0 -%}
<tr>
<th class="shrink">Cookies</th>
<td>{%= renderCookiesHidden(fmt.Sprintf("response-cookies-%s", key), r.Cookies, ps) %}</td>
</tr>
{%- endif -%}
{%- if r.Content != nil && r.Content.Text != "" -%}
<tr>
<th class="shrink">Body</th>
<td>
<div class="right"><em>{% if r.ContentType() != "" %}{%s r.ContentType() %}, {% endif %}{%s util.ByteSizeSI(int64(r.Content.Size)) %}</em></div>
<ul class="accordion">
<li>
<input id="accordion-response-body-{%s key %}" type="checkbox" hidden />
<label class="no-padding" for="accordion-response-body-{%s key %}"><em>(click to show)</em></label>
<div class="bd"><div><div>
{%- if strings.HasPrefix(r.ContentType(), "image/") -%}
<img style="border: var(--border)" src="data:{%s r.ContentType() %};base64,{%s r.Content.Text %}" />
{%- else -%}
<pre>{%s r.Content.Text %}</pre>
{%- endif -%}
</div></div></div>
</li>
</ul>
</td>
</tr>
{%- endif -%}
</tbody>
</table>
</div>
{% endfunc %}