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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
| {% import ( "slices"
"github.com/samber/lo" "github.com/valyala/fasthttp"
"{{{ .Package }}}/app" "{{{ .Package }}}/app/controller/cutil" "{{{ .Package }}}/views/components" "{{{ .Package }}}/views/layout" ) %}
{% code type Request struct { layout.Basic RC *fasthttp.RequestCtx } %}
{% func (p *Request) Body(as *app.State, ps *cutil.PageState) %} <div class="card"> <div class="right"><a href="#modal-ps"><button type="button">Page State</button></a></div> <h3>Request Debug</h3> <div class="overflow full-width"> <table> <thead> <tr> <th>Key</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>ID</td> <td>{%dul p.RC.ID() %}</td> </tr> <tr> <td>URL</td> <td>{%s p.RC.URI().String() %}</td> </tr> <tr> <td>Protocol</td> <td>{%s string(p.RC.Request.URI().Scheme()) %}</td> </tr> <tr> <td>Host</td> <td>{%s string(p.RC.Request.URI().Host()) %}</td> </tr> <tr> <td>Path</td> <td>{%s string(p.RC.Request.URI().Path()) %}</td> </tr> <tr> <td>Query String</td> <td>{%s string(p.RC.Request.URI().QueryString()) %}</td> </tr> <tr> <td>Body Size</td> <td>{%d len(p.RC.Request.Body()) %}</td> </tr> <tr> <td>Browser</td> <td>{%s ps.Browser %} {%s ps.BrowserVersion %}</td> </tr> <tr> <td>OS</td> <td>{%s ps.OS %} {%s ps.OSVersion %}</td> </tr> </tbody> </table> </div> </div> {%- if p.RC.Request.Header.Len() > 0 -%} {%- code hd := cutil.RequestHeadersMap(p.RC) -%} <div class="card"> <h3>Headers</h3> <div class="overflow full-width"> <table> <thead> <tr> <th>Key</th> <th>Value</th> </tr> </thead> <tbody> {%- code keys := lo.Keys(hd) slices.Sort(keys) -%} {%- for _, k := range keys -%} <tr> <td class="nowrap">{%s k %}</td> <td>{%s hd[k] %}</td> </tr> {%- endfor -%} </tbody> </table> </div> </div> {%- endif -%} {%= components.JSONModal("ps", "Page State", ps, 1) %} {% endfunc %}
|