mockaton 7.5.1 → 7.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/package.json +1 -1
- package/src/Dashboard.css +11 -6
- package/src/Dashboard.js +6 -2
- package/src/Mockaton.js +4 -4
- package/src/mockaton-logo.svg +2 -2
package/README.md
CHANGED
|
@@ -150,6 +150,8 @@ export default function optionalName(request, response) {
|
|
|
150
150
|
}
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
+
If you need to serve a static `.js` file, put it in `Config.staticDir`.
|
|
154
|
+
|
|
153
155
|
|
|
154
156
|
## File Name Convention
|
|
155
157
|
|
|
@@ -203,6 +205,16 @@ api/foo/.GET.200.json
|
|
|
203
205
|
|
|
204
206
|
---
|
|
205
207
|
|
|
208
|
+
## `Config.staticDir`
|
|
209
|
+
Files under `Config.staticDir` don’t use the filename convention.
|
|
210
|
+
Also, they take precedence over the `GET` mocks in `Config.mockDir`.
|
|
211
|
+
|
|
212
|
+
For example, if you have two files for `GET /foo/bar.jpg`
|
|
213
|
+
```
|
|
214
|
+
my-static-dir/foo/bar.jpg
|
|
215
|
+
my-mocks-dir/foo/bar.jpg.GET.200.jpg // Unreacheable
|
|
216
|
+
```
|
|
217
|
+
|
|
206
218
|
|
|
207
219
|
## `Config.proxyFallback`
|
|
208
220
|
Lets you specify a target server for serving routes you don’t have mocks for.
|
|
@@ -360,3 +372,4 @@ await mockaton.reset()
|
|
|
360
372
|
## TODO
|
|
361
373
|
- Refactor Tests
|
|
362
374
|
- Dashboard. List `staticDir` and indicate if it’s overriding some mock.
|
|
375
|
+
- jsonc, json5
|
package/package.json
CHANGED
package/src/Dashboard.css
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
--colorHeaderBackground: #eee;
|
|
11
11
|
--colorComboBoxBackground: #fafafa;
|
|
12
12
|
--colorComboBoxHeaderBackground: #fff;
|
|
13
|
-
--colorDisabled: #
|
|
13
|
+
--colorDisabled: #555;
|
|
14
14
|
--colorHover: #dfefff;
|
|
15
15
|
--colorLabel: #666;
|
|
16
16
|
--colorLightRed: #ffe4ee;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
--colorHeaderBackground: #090909;
|
|
28
28
|
--colorComboBoxBackground: #252525;
|
|
29
29
|
--colorComboBoxHeaderBackground: #222;
|
|
30
|
-
--colorDisabled: #
|
|
30
|
+
--colorDisabled: #bbb;
|
|
31
31
|
--colorHover: #023661;
|
|
32
32
|
--colorLabel: #aaa;
|
|
33
33
|
--colorLightRed: #ffe4ee;
|
|
@@ -70,9 +70,7 @@ select {
|
|
|
70
70
|
background: var(--colorHover);
|
|
71
71
|
}
|
|
72
72
|
&:disabled {
|
|
73
|
-
background: transparent;
|
|
74
73
|
cursor: not-allowed;
|
|
75
|
-
color: var(--colorDisabled);
|
|
76
74
|
}
|
|
77
75
|
}
|
|
78
76
|
|
|
@@ -86,7 +84,7 @@ menu {
|
|
|
86
84
|
align-items: flex-end;
|
|
87
85
|
padding: 20px 16px;
|
|
88
86
|
background: var(--colorHeaderBackground);
|
|
89
|
-
|
|
87
|
+
border-bottom: 1px solid rgba(127, 127, 127, 0.17);
|
|
90
88
|
gap: 16px;
|
|
91
89
|
|
|
92
90
|
img {
|
|
@@ -150,7 +148,7 @@ main {
|
|
|
150
148
|
}
|
|
151
149
|
|
|
152
150
|
tr {
|
|
153
|
-
border-
|
|
151
|
+
border-top: 1px solid transparent;
|
|
154
152
|
}
|
|
155
153
|
}
|
|
156
154
|
}
|
|
@@ -215,6 +213,13 @@ main {
|
|
|
215
213
|
&.status4xx {
|
|
216
214
|
background: var(--color4xxBackground);
|
|
217
215
|
}
|
|
216
|
+
&:disabled {
|
|
217
|
+
appearance: none;
|
|
218
|
+
background: transparent;
|
|
219
|
+
cursor: default;
|
|
220
|
+
color: var(--colorDisabled);
|
|
221
|
+
opacity: 1;
|
|
222
|
+
}
|
|
218
223
|
}
|
|
219
224
|
|
|
220
225
|
.DelayToggler {
|
package/src/Dashboard.js
CHANGED
|
@@ -93,18 +93,22 @@ function CookieSelector({ list }) {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
function BulkSelector({ comments }) {
|
|
96
|
+
const disabled = !comments.length
|
|
97
|
+
const list = disabled
|
|
98
|
+
? []
|
|
99
|
+
: [Strings.select_one].concat(comments)
|
|
96
100
|
return (
|
|
97
101
|
r('label', null,
|
|
98
102
|
r('span', null, Strings.bulk_select_by_comment),
|
|
99
103
|
r('select', {
|
|
100
104
|
autocomplete: 'off',
|
|
101
|
-
disabled
|
|
105
|
+
disabled,
|
|
102
106
|
onChange() {
|
|
103
107
|
mockaton.bulkSelectByComment(this.value)
|
|
104
108
|
.then(init)
|
|
105
109
|
.catch(console.error)
|
|
106
110
|
}
|
|
107
|
-
},
|
|
111
|
+
}, list.map(item =>
|
|
108
112
|
r('option', {
|
|
109
113
|
value: item
|
|
110
114
|
}, item)))))
|
package/src/Mockaton.js
CHANGED
|
@@ -46,13 +46,13 @@ async function onRequest(req, response) {
|
|
|
46
46
|
if (isPreflight(req))
|
|
47
47
|
sendNoContent(response)
|
|
48
48
|
|
|
49
|
-
else if (method === 'GET' && apiGetRequests.has(url))
|
|
50
|
-
apiGetRequests.get(url)(req, response)
|
|
51
|
-
|
|
52
49
|
else if (method === 'PATCH' && apiPatchRequests.has(url))
|
|
53
50
|
await apiPatchRequests.get(url)(req, response)
|
|
54
51
|
|
|
55
|
-
else if (
|
|
52
|
+
else if (method === 'GET' && apiGetRequests.has(url))
|
|
53
|
+
apiGetRequests.get(url)(req, response)
|
|
54
|
+
|
|
55
|
+
else if (method === 'GET' && isStatic(req)) // TESTME
|
|
56
56
|
await dispatchStatic(req, response)
|
|
57
57
|
|
|
58
58
|
else
|
package/src/mockaton-logo.svg
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<svg version="1.1" viewBox="0 0 570 100" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<style>
|
|
4
4
|
:root { --color: #000000; }
|
|
5
|
-
@media (prefers-color-scheme: light) { :root { --color: #
|
|
6
|
-
@media (prefers-color-scheme: dark) { :root { --color: #
|
|
5
|
+
@media (prefers-color-scheme: light) { :root { --color: #444 } }
|
|
6
|
+
@media (prefers-color-scheme: dark) { :root { --color: #eee } }
|
|
7
7
|
path { fill: var(--color) }
|
|
8
8
|
</style>
|
|
9
9
|
<path
|