page.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <html>
  2. <head>
  3. <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
  4. <link rel="stylesheet" href="http://yandex.st/highlightjs/7.3/styles/default.min.css">
  5. <script src="http://yandex.st/highlightjs/7.3/highlight.min.js"></script>
  6. <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
  7. <script>hljs.initHighlightingOnLoad();</script>
  8. <script type="text/javascript">
  9. $(function() {
  10. $("ul.request.nav a").click(function() {
  11. $(this).closest("div").find(".raw, .headers, .summary").hide();
  12. $(this).closest("div").find("." + $(this).attr("target")).show();
  13. $(this).closest("ul").find("li.active").removeClass("active");
  14. $(this).parent().addClass("active");
  15. return false;
  16. });
  17. $(".replay").click(function() {
  18. $.ajax({
  19. type: "POST",
  20. url: "/http/in/replay",
  21. data: { txnid: $(this).closest(".txn").attr("txnid") }
  22. });
  23. return false;
  24. });
  25. });
  26. </script>
  27. <style type="text/css">
  28. body { margin-top: 50px; }
  29. ul.history > li { none; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #ccc; }
  30. .headers, .raw { display: none; }
  31. </style>
  32. </head>
  33. <body>
  34. <div class="container">
  35. <div class="navbar navbar-inverse navbar-fixed-top">
  36. <div class="navbar-inner">
  37. <div class="container">
  38. <a class="brand" href="#">ngrok</a>
  39. <ul class="nav">
  40. <li class="active"><a href="#">Inbound Requests</a></li>
  41. <li><a href="#">Outbound Requests</a></li>
  42. <li><a href="#">Configuration</a></li>
  43. </ul>
  44. </div>
  45. </div>
  46. </div>
  47. <ul class="history unstyled">
  48. {{ range .HttpRequests.Slice }}
  49. <li class="txn" txnid="{{ .Id }}">
  50. <div class="row">
  51. <div class="span6">
  52. {{ with .Req }}
  53. <h3>{{ .Method }} {{ .URL.Path }}</h3>
  54. <ul class="request nav nav-pills">
  55. <li class="active"><a target="summary" href="#">Summary</a></li>
  56. <li><a href="#" target="headers">Headers</a></li>
  57. <li><a href="#" target="raw">Raw</a></li>
  58. <li class="pull-right"><button class="replay btn btn-primary">Replay</button></li>
  59. </ul>
  60. <div class="raw">
  61. {{ with $raw := dumpRequest . }}
  62. <pre><code class="http">{{ $raw }}</code></pre>
  63. {{ end }}
  64. </div>
  65. <div class="headers">
  66. {{ with .Header }}
  67. <h6>Headers</h6>
  68. <table class="table">
  69. {{ range $key, $value := .}}
  70. <tr>
  71. <th> {{ $key }} </th>
  72. <td> {{ $value }} </td>
  73. </tr>
  74. {{ end }}
  75. </table>
  76. {{ end }}
  77. </div>
  78. <div class="summary">
  79. {{ with .URL.Query }}
  80. <h6>Query Params</h6>
  81. <table class="table">
  82. {{ range $key, $value := .}}
  83. <tr>
  84. <th> {{ $key }} </th>
  85. <td> {{ $value }} </td>
  86. </tr>
  87. {{ end }}
  88. </table>
  89. {{ end }}
  90. {{ template "body" . }}
  91. </div>
  92. {{ end }}
  93. </div>
  94. <div class="span6">
  95. {{ with .Resp }}
  96. <h3 class="{{ classForStatus .Status }}">{{ .Status }}</h3>
  97. {{ with $raw := dumpResponse . }}
  98. <pre><code class="http">{{ $raw }}</code></pre>
  99. {{ end }}
  100. {{ end }}
  101. </div>
  102. </div>
  103. </li>
  104. {{ end }}
  105. </ul>
  106. </div>
  107. </body>
  108. </html>