mockaton 8.1.0 → 8.1.1
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-dashboard-dark.png +0 -0
- package/README-dashboard-light.png +0 -0
- package/package.json +1 -1
- package/src/Dashboard.js +6 -4
- package/src/Mockaton.js +1 -1
- package/src/utils/http-cors.js +1 -0
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/src/Dashboard.js
CHANGED
|
@@ -36,7 +36,7 @@ const CSS = {
|
|
|
36
36
|
|
|
37
37
|
const r = createElement
|
|
38
38
|
const refPayloadViewer = useRef()
|
|
39
|
-
const
|
|
39
|
+
const refPayloadViewerFileTitle = useRef()
|
|
40
40
|
|
|
41
41
|
const mockaton = new Commander(window.location.origin)
|
|
42
42
|
|
|
@@ -72,7 +72,7 @@ function DevPanel(brokersByMethod, cookies, comments, corsAllowed, staticFiles)
|
|
|
72
72
|
r('table', null, Object.entries(brokersByMethod).map(([method, brokers]) =>
|
|
73
73
|
r(SectionByMethod, { method, brokers }))),
|
|
74
74
|
r('div', { className: CSS.PayloadViewer },
|
|
75
|
-
r('h2', { ref:
|
|
75
|
+
r('h2', { ref: refPayloadViewerFileTitle }, Strings.mock),
|
|
76
76
|
r('pre', null,
|
|
77
77
|
r('code', { ref: refPayloadViewer }, Strings.click_link_to_preview)))),
|
|
78
78
|
r(StaticFilesList, { staticFiles })))
|
|
@@ -200,13 +200,15 @@ function PreviewLink({ method, urlMask }) {
|
|
|
200
200
|
document.querySelector(`.${CSS.PreviewLink}.${CSS.chosen}`)?.classList.remove(CSS.chosen)
|
|
201
201
|
this.classList.add(CSS.chosen)
|
|
202
202
|
clearTimeout(spinner)
|
|
203
|
+
|
|
203
204
|
const mime = res.headers.get('content-type') || ''
|
|
204
205
|
if (mime.startsWith('image/')) // naively assumes GET.200
|
|
205
206
|
renderPayloadImage(this.href)
|
|
206
207
|
else
|
|
207
208
|
updatePayloadViewer(await res.text() || Strings.empty_response_body, mime)
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
|
|
210
|
+
empty(refPayloadViewerFileTitle.current)
|
|
211
|
+
refPayloadViewerFileTitle.current.append(PayloadViewerTitle({
|
|
210
212
|
file: this.closest('tr').querySelector('select').value
|
|
211
213
|
}))
|
|
212
214
|
}
|
package/src/Mockaton.js
CHANGED
|
@@ -38,7 +38,7 @@ async function onRequest(req, response) {
|
|
|
38
38
|
methods: Config.corsMethods,
|
|
39
39
|
maxAge: Config.corsMaxAge,
|
|
40
40
|
credentials: Config.corsCredentials,
|
|
41
|
-
exposedHeaders: Config.
|
|
41
|
+
exposedHeaders: Config.corsExposedHeaders
|
|
42
42
|
})
|
|
43
43
|
|
|
44
44
|
const { url, method } = req
|
package/src/utils/http-cors.js
CHANGED