mockaton 7.4.1 → 7.5.0
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 +0 -1
- package/package.json +1 -1
- package/sample-mocks/api/user/avatar.GET.200.png +0 -0
- package/sample-mocks/api/user/friends.GET.200.json +3 -1
- package/sample-mocks/api/user.GET.200.json +4 -1
- package/sample-mocks/api/video/stat/[stat-id]/[video-id].GET.200.json +3 -1
- package/src/Dashboard.css +10 -7
- package/src/Dashboard.js +11 -4
package/README.md
CHANGED
package/package.json
CHANGED
|
Binary file
|
package/src/Dashboard.css
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
:root {
|
|
24
24
|
--color4xxBackground: #403630;
|
|
25
25
|
--colorAccent: #1f91ff;
|
|
26
|
-
--colorBackground: #
|
|
26
|
+
--colorBackground: #161616;
|
|
27
27
|
--colorComboBoxBackground: #252525;
|
|
28
28
|
--colorComboBoxHeaderBackground: #222;
|
|
29
29
|
--colorDisabled: #aaa;
|
|
@@ -155,7 +155,7 @@ main {
|
|
|
155
155
|
|
|
156
156
|
.PayloadViewer {
|
|
157
157
|
position: sticky;
|
|
158
|
-
top:
|
|
158
|
+
top: 60px;
|
|
159
159
|
width: 50%;
|
|
160
160
|
margin-left: 20px;
|
|
161
161
|
|
|
@@ -168,13 +168,15 @@ main {
|
|
|
168
168
|
max-height: calc(100vh - 160px);
|
|
169
169
|
padding: 12px;
|
|
170
170
|
padding-left: 0;
|
|
171
|
-
margin-top: 6px;
|
|
172
|
-
border-radius: 4px;
|
|
173
|
-
white-space: pre;
|
|
174
|
-
tab-size: 2;
|
|
175
171
|
|
|
176
|
-
code
|
|
172
|
+
code {
|
|
173
|
+
white-space: pre;
|
|
174
|
+
tab-size: 2;
|
|
177
175
|
font-family: monospace;
|
|
176
|
+
|
|
177
|
+
* {
|
|
178
|
+
font-family: monospace;
|
|
179
|
+
}
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
182
|
}
|
|
@@ -307,6 +309,7 @@ main {
|
|
|
307
309
|
* Prism
|
|
308
310
|
*/
|
|
309
311
|
|
|
312
|
+
|
|
310
313
|
@media (prefers-color-scheme: dark) {
|
|
311
314
|
.token.cdata, .token.comment, .token.doctype, .token.prolog {
|
|
312
315
|
color: #8292a2
|
package/src/Dashboard.js
CHANGED
|
@@ -172,9 +172,11 @@ function PreviewLink({ method, urlMask }) {
|
|
|
172
172
|
document.querySelector(`.${CSS.PreviewLink}.${CSS.chosen}`)?.classList.remove(CSS.chosen)
|
|
173
173
|
this.classList.add(CSS.chosen)
|
|
174
174
|
clearTimeout(spinner)
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
const mime = res.headers.get('content-type')
|
|
176
|
+
if (mime.startsWith('image/')) // naively assumes GET.200
|
|
177
|
+
renderPayloadImage(this.href)
|
|
178
|
+
else
|
|
179
|
+
updatePayloadViewer(await res.text() || Strings.empty_response_body, mime)
|
|
178
180
|
refPayloadFile.current.innerText = this.closest('tr').querySelector('select').value
|
|
179
181
|
}
|
|
180
182
|
catch (error) {
|
|
@@ -190,8 +192,13 @@ function ProgressBar() {
|
|
|
190
192
|
r('div', { style: { animationDuration: '1000ms' } }))) // TODO from Config.delay - 180
|
|
191
193
|
}
|
|
192
194
|
|
|
195
|
+
function renderPayloadImage(href) {
|
|
196
|
+
empty(refPayloadViewer.current)
|
|
197
|
+
refPayloadViewer.current.append(r('img', { src: href }))
|
|
198
|
+
}
|
|
199
|
+
|
|
193
200
|
function updatePayloadViewer(body, mime) {
|
|
194
|
-
if (mime === 'application/json' && window.
|
|
201
|
+
if (mime === 'application/json' && window?.Prism.languages)
|
|
195
202
|
refPayloadViewer.current.innerHTML = window.Prism.highlight(body, window.Prism.languages.json, 'json')
|
|
196
203
|
else
|
|
197
204
|
refPayloadViewer.current.innerText = body
|