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.
Binary file
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mockaton",
3
3
  "description": "A deterministic server-side for developing and testing frontend clients",
4
4
  "type": "module",
5
- "version": "8.1.0",
5
+ "version": "8.1.1",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
8
8
  "license": "MIT",
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 refPayloadFile = useRef()
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: refPayloadFile }, Strings.mock),
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
- empty(refPayloadFile.current)
209
- refPayloadFile.current.append(PayloadViewerTitle({
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.extraHeaders
41
+ exposedHeaders: Config.corsExposedHeaders
42
42
  })
43
43
 
44
44
  const { url, method } = req
@@ -62,6 +62,7 @@ function setPreflightSpecificHeaders(req, response, methods, headers, maxAge) {
62
62
  }
63
63
 
64
64
 
65
+ // TESTME
65
66
  function setActualRequestHeaders(response, exposedHeaders) {
66
67
  // Exposed means the client-side JavaScript can read them
67
68
  if (exposedHeaders.length)