-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtpl.html
69 lines (66 loc) · 1.92 KB
/
tpl.html
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
<!DOCTYPE html>
<html>
<head>
<title>http-request-mock-with-nodejs</title>
<link rel="stylesheet" href="/default.min.css">
<script src="/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
<style>
* { font-size: 12px; }
a {color: blue; text-decoration: none; margin: 0 5px;}
h5 { text-align: center;}
.codes { margin-top: 0px; }
table { min-width: 800px; width: 100% }
td { min-width: 400px }
.container {
margin: 30px;
width: 50%;
margin: 0 auto;
min-width: 750px;
}
</style>
</head>
<body>
<div class="container">
<h5>http-request-mock: Integration with nodejs</h5>
<div>Try to access the links below:</div>
<div class="links">
<a href="/dynamic">/dynamic</a>
<a href="/static">/static</a>
<a href="/delay">/delay</a>
<a href="/faker">/faker</a>
<a href="/times">/times</a>
<a href="/404">/404</a>
<a href="/photos/1?bypass=1">/bypass1</a>
<a href="/photos/1?bypass=2">/bypass2</a>
<a href="/header">/header</a>
<a href="/request-info?a=123&b=456">/request-info</a>
<a href="/remote?a=123&b=456">/remote</a>
</div>
<br>
Mock definition:
<pre class="codes"><code class="javascript">__mock_definitions__</code></pre>
Result:
<pre class="codes"><code class="json">__request_result__</code></pre>
<pre>Spent: -</pre>
<pre>Response Headers: -</pre>
</div>
</body>
</html>
<script>
window.onload = function() {
try {
const url = location.pathname + location.search;
const links = [...document.querySelectorAll('.links a')];
for(const link of links) {
if (link.getAttribute('href') === url) {
link.style.color = 'black';
link.style.fontWeight = 'bold';
break;
}
}
} catch(err) {
console.log('err:', err);
}
};
</script>