github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/vadmin/Request.html.go (about)

     1  // Code generated by qtc from "Request.html". DO NOT EDIT.
     2  // See https://github.com/valyala/quicktemplate for details.
     3  
     4  // <!-- Content managed by Project Forge, see [projectforge.md] for details. -->
     5  
     6  //line views/vadmin/Request.html:2
     7  package vadmin
     8  
     9  //line views/vadmin/Request.html:2
    10  import (
    11  	"net/http"
    12  
    13  	"github.com/samber/lo"
    14  
    15  	"github.com/kyleu/dbaudit/app"
    16  	"github.com/kyleu/dbaudit/app/controller/cutil"
    17  	"github.com/kyleu/dbaudit/app/util"
    18  	"github.com/kyleu/dbaudit/views/components"
    19  	"github.com/kyleu/dbaudit/views/layout"
    20  )
    21  
    22  //line views/vadmin/Request.html:14
    23  import (
    24  	qtio422016 "io"
    25  
    26  	qt422016 "github.com/valyala/quicktemplate"
    27  )
    28  
    29  //line views/vadmin/Request.html:14
    30  var (
    31  	_ = qtio422016.Copy
    32  	_ = qt422016.AcquireByteBuffer
    33  )
    34  
    35  //line views/vadmin/Request.html:14
    36  type Request struct {
    37  	layout.Basic
    38  	Rsp http.ResponseWriter
    39  	Req *http.Request
    40  }
    41  
    42  //line views/vadmin/Request.html:20
    43  func (p *Request) StreamBody(qw422016 *qt422016.Writer, as *app.State, ps *cutil.PageState) {
    44  //line views/vadmin/Request.html:20
    45  	qw422016.N().S(`
    46    <div class="card">
    47      <div class="right"><a href="#modal-ps"><button type="button">Page State</button></a></div>
    48      <h3>Request Debug</h3>
    49      <div class="overflow full-width">
    50        <table>
    51          <thead>
    52            <tr>
    53              <th>Key</th>
    54              <th>Value</th>
    55            </tr>
    56          </thead>
    57          <tbody>
    58            <tr>
    59              <td>URL</td>
    60              <td>`)
    61  //line views/vadmin/Request.html:35
    62  	qw422016.E().S(p.Req.URL.String())
    63  //line views/vadmin/Request.html:35
    64  	qw422016.N().S(`</td>
    65            </tr>
    66            <tr>
    67              <td>Protocol</td>
    68              <td>`)
    69  //line views/vadmin/Request.html:39
    70  	qw422016.E().S(p.Req.URL.Scheme)
    71  //line views/vadmin/Request.html:39
    72  	qw422016.N().S(`</td>
    73            </tr>
    74            <tr>
    75              <td>Host</td>
    76              <td>`)
    77  //line views/vadmin/Request.html:43
    78  	qw422016.E().S(p.Req.URL.Host)
    79  //line views/vadmin/Request.html:43
    80  	qw422016.N().S(`</td>
    81            </tr>
    82            <tr>
    83              <td>Path</td>
    84              <td>`)
    85  //line views/vadmin/Request.html:47
    86  	qw422016.E().S(p.Req.URL.Path)
    87  //line views/vadmin/Request.html:47
    88  	qw422016.N().S(`</td>
    89            </tr>
    90            <tr>
    91              <td>Query String</td>
    92              <td>`)
    93  //line views/vadmin/Request.html:51
    94  	qw422016.E().S(p.Req.URL.RawQuery)
    95  //line views/vadmin/Request.html:51
    96  	qw422016.N().S(`</td>
    97            </tr>
    98            <tr>
    99              <td>Body Size</td>
   100              <td>`)
   101  //line views/vadmin/Request.html:55
   102  	qw422016.E().S(util.ByteSizeSI(int64(len(ps.RequestBody))))
   103  //line views/vadmin/Request.html:55
   104  	qw422016.N().S(`</td>
   105            </tr>
   106            <tr>
   107              <td>Browser</td>
   108              <td>`)
   109  //line views/vadmin/Request.html:59
   110  	qw422016.E().S(ps.Browser)
   111  //line views/vadmin/Request.html:59
   112  	qw422016.N().S(` `)
   113  //line views/vadmin/Request.html:59
   114  	qw422016.E().S(ps.BrowserVersion)
   115  //line views/vadmin/Request.html:59
   116  	qw422016.N().S(`</td>
   117            </tr>
   118            <tr>
   119              <td>OS</td>
   120              <td>`)
   121  //line views/vadmin/Request.html:63
   122  	qw422016.E().S(ps.OS)
   123  //line views/vadmin/Request.html:63
   124  	qw422016.N().S(` `)
   125  //line views/vadmin/Request.html:63
   126  	qw422016.E().S(ps.OSVersion)
   127  //line views/vadmin/Request.html:63
   128  	qw422016.N().S(`</td>
   129            </tr>
   130          </tbody>
   131        </table>
   132      </div>
   133    </div>
   134  `)
   135  //line views/vadmin/Request.html:69
   136  	if len(p.Req.Header) > 0 {
   137  //line views/vadmin/Request.html:70
   138  		hd := cutil.RequestHeadersMap(p.Req)
   139  
   140  //line views/vadmin/Request.html:70
   141  		qw422016.N().S(`  <div class="card">
   142      <h3>Headers</h3>
   143      <div class="overflow full-width">
   144        <table>
   145          <thead>
   146            <tr>
   147              <th>Key</th>
   148              <th>Value</th>
   149            </tr>
   150          </thead>
   151          <tbody>
   152  `)
   153  //line views/vadmin/Request.html:82
   154  		for _, k := range util.ArraySorted(lo.Keys(hd)) {
   155  //line views/vadmin/Request.html:82
   156  			qw422016.N().S(`          <tr>
   157              <td class="nowrap">`)
   158  //line views/vadmin/Request.html:84
   159  			qw422016.E().S(k)
   160  //line views/vadmin/Request.html:84
   161  			qw422016.N().S(`</td>
   162              <td>`)
   163  //line views/vadmin/Request.html:85
   164  			qw422016.E().S(hd.GetStringOpt(k))
   165  //line views/vadmin/Request.html:85
   166  			qw422016.N().S(`</td>
   167            </tr>
   168  `)
   169  //line views/vadmin/Request.html:87
   170  		}
   171  //line views/vadmin/Request.html:87
   172  		qw422016.N().S(`        </tbody>
   173        </table>
   174      </div>
   175    </div>
   176  `)
   177  //line views/vadmin/Request.html:92
   178  	}
   179  //line views/vadmin/Request.html:92
   180  	qw422016.N().S(`  `)
   181  //line views/vadmin/Request.html:93
   182  	components.StreamJSONModal(qw422016, "ps", "Page State", ps, 1)
   183  //line views/vadmin/Request.html:93
   184  	qw422016.N().S(`
   185  `)
   186  //line views/vadmin/Request.html:94
   187  }
   188  
   189  //line views/vadmin/Request.html:94
   190  func (p *Request) WriteBody(qq422016 qtio422016.Writer, as *app.State, ps *cutil.PageState) {
   191  //line views/vadmin/Request.html:94
   192  	qw422016 := qt422016.AcquireWriter(qq422016)
   193  //line views/vadmin/Request.html:94
   194  	p.StreamBody(qw422016, as, ps)
   195  //line views/vadmin/Request.html:94
   196  	qt422016.ReleaseWriter(qw422016)
   197  //line views/vadmin/Request.html:94
   198  }
   199  
   200  //line views/vadmin/Request.html:94
   201  func (p *Request) Body(as *app.State, ps *cutil.PageState) string {
   202  //line views/vadmin/Request.html:94
   203  	qb422016 := qt422016.AcquireByteBuffer()
   204  //line views/vadmin/Request.html:94
   205  	p.WriteBody(qb422016, as, ps)
   206  //line views/vadmin/Request.html:94
   207  	qs422016 := string(qb422016.B)
   208  //line views/vadmin/Request.html:94
   209  	qt422016.ReleaseByteBuffer(qb422016)
   210  //line views/vadmin/Request.html:94
   211  	return qs422016
   212  //line views/vadmin/Request.html:94
   213  }