mockaton 13.4.1 → 13.4.2

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mockaton",
3
3
  "description": "HTTP Mock Server",
4
4
  "type": "module",
5
- "version": "13.4.1",
5
+ "version": "13.4.2",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": "./index.js",
@@ -74,7 +74,7 @@ function request(path, options = {}) {
74
74
  class Fixture {
75
75
  constructor(file, body = '') {
76
76
  this.file = file
77
- this.body = body || `Body for ${file}`
77
+ this.body = body || `Body for: ${file}`
78
78
  const t = parseFilename(file)
79
79
  this.urlMask = t.urlMask
80
80
  this.method = t.method
@@ -336,7 +336,8 @@ describe('Proxy Fallback', () => {
336
336
  response.writeHead(423, {
337
337
  'custom_header': 'my_custom_header',
338
338
  'content-type': mimeFor('.json'),
339
- 'set-cookie': CUSTOM_COOKIES
339
+ 'set-cookie': CUSTOM_COOKIES,
340
+ 'cache-control': 'public'
340
341
  })
341
342
  response.end(JSON.stringify(BODY_PAYLOAD))
342
343
  })
@@ -359,6 +360,9 @@ describe('Proxy Fallback', () => {
359
360
 
360
361
  equal(r1.headers.get('set-cookie'), CUSTOM_COOKIES.join(', '))
361
362
  equal(r2.headers.get('set-cookie'), CUSTOM_COOKIES.join(', '))
363
+
364
+ equal(r1.headers.get('cache-control'), 'no-cache') // unsets cache
365
+ equal(r2.headers.get('cache-control'), 'no-cache')
362
366
 
363
367
  deepEqual(await r2.json(), BODY_PAYLOAD)
364
368
  deepEqual(await r1.json(), BODY_PAYLOAD)
@@ -34,7 +34,8 @@ export async function proxy(req, response, delay) {
34
34
 
35
35
  response.writeHead(proxyResponse.status, {
36
36
  ...Object.fromEntries(proxyResponse.headers),
37
- 'Set-Cookie': proxyResponse.headers.getSetCookie() // parses multiple into an array
37
+ 'set-cookie': proxyResponse.headers.getSetCookie(), // parses multiple into an array
38
+ 'cache-control': 'no-cache'
38
39
  })
39
40
  const body = await proxyResponse.text()
40
41
  setTimeout(() => response.end(body), delay) // TESTME