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
| {% import ( "net/http"
"{{{ .Package }}}/app" "{{{ .Package }}}/app/controller/cutil" "{{{ .Package }}}/app/util" "{{{ .Package }}}/views/components" "{{{ .Package }}}/views/layout" ) %}
{% code type Request struct { layout.Basic Rsp http.ResponseWriter Req *http.Request } %}
{% 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>{%= components.SVGIcon(`link`, ps) %} Request Debug</h3> <div class="overflow full-width"> <table> <thead> <tr> <th>Key</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>URL</td> <td>{%s p.Req.URL.String() %}</td> </tr> <tr> <td>Protocol</td> <td>{%s p.Req.URL.Scheme %}</td> </tr> <tr> <td>Host</td> <td>{%s p.Req.URL.Host %}</td> </tr> <tr> <td>Path</td> <td>{%s p.Req.URL.Path %}</td> </tr> <tr> <td>Query String</td> <td>{%s p.Req.URL.RawQuery %}</td> </tr> <tr> <td>Body Size</td> <td>{%s util.ByteSizeSI(int64(len(ps.RequestBody))) %}</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 len(p.Req.Header) > 0 -%} {%- code hd := cutil.RequestHeadersMap(p.Req) -%} <div class="card"> <h3>{%= components.SVGIcon(`code`, ps) %} Headers</h3> <div class="overflow full-width"> <table> <thead> <tr> <th>Key</th> <th>Value</th> </tr> </thead> <tbody> {%- for _, k := range util.MapKeysSorted(hd) -%} <tr> <td class="nowrap">{%s k %}</td> <td>{%s hd.GetStringOpt(k) %}</td> </tr> {%- endfor -%} </tbody> </table> </div> </div> {%- endif -%} {%= components.JSONModal("ps", "Page State", ps, 1) %} {% endfunc %}
|