mockaton 13.9.9 → 13.9.10

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.9.9",
5
+ "version": "13.9.10",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": "./index.js",
@@ -4,8 +4,8 @@
4
4
  --colorBgField: light-dark(#fcfcfc, #2c2c2c);
5
5
  --colorBgFieldHover: light-dark(#fff, #171717);
6
6
 
7
- --colorBgHeader: light-dark(#f0f0f2, #141414);
8
- --colorBgHeaderField: light-dark(#fafafa, #222);
7
+ --colorBgHeader: light-dark(#ededef, #141414);
8
+ --colorBgHeaderField: light-dark(#fbfbfb, #222);
9
9
 
10
10
  --colorBorder: light-dark(#e0e0e0, #2c2c2c);
11
11
  --colorBorderActive: light-dark(#c8c8c8, #3c3c3c);
@@ -28,7 +28,7 @@
28
28
 
29
29
  --shadowRim: light-dark(#fff, #333);
30
30
  --shadowDrop: light-dark(rgba(0, 0, 0, 0.2), #000);
31
- --boxShadowRimDrop: inset 0 0 1px 1px var(--shadowRim), 0 1px 2px var(--shadowDrop);
31
+ --boxShadowRimDrop: inset 0 0 1px 0.5px var(--shadowRim), 0 1px 2px var(--shadowDrop);
32
32
  }
33
33
 
34
34
  html,
@@ -287,7 +287,7 @@ header {
287
287
  }
288
288
 
289
289
  span {
290
- margin-left: 4px;
290
+ margin-left: 8px;
291
291
  }
292
292
  input {
293
293
  border-bottom-left-radius: 0;
@@ -19,7 +19,7 @@ export function dittoSplitPaths(paths) {
19
19
  if (!j) // no common dirs
20
20
  return ['', p]
21
21
 
22
- const ditto = '/' + curr.slice(0, j).join('/') + '/'
22
+ const ditto = '/' + curr.slice(0, j).join('/')
23
23
  return [ditto, p.slice(ditto.length)]
24
24
  })
25
25
  }
@@ -12,17 +12,19 @@ test('dittoSplitPaths', () => {
12
12
  '/api/video/id',
13
13
  '/api/video/stats',
14
14
  '/v2/foo',
15
- '/v2/foo/bar'
15
+ '/v2/foo/bar',
16
+ '/v2/foo/bar' // paths can be repeated
16
17
  ]
17
18
  deepEqual(dittoSplitPaths(input), [
18
19
  ['', '/api/user'],
19
- ['/api/user/', 'avatar'],
20
- ['/api/user/', 'friends'],
21
- ['/api/', 'vid'],
22
- ['/api/', 'video/id'],
23
- ['/api/video/', 'stats'],
20
+ ['/api/user', '/avatar'],
21
+ ['/api/user', '/friends'],
22
+ ['/api', '/vid'],
23
+ ['/api', '/video/id'],
24
+ ['/api/video', '/stats'],
24
25
  ['', '/v2/foo'],
25
- ['/v2/foo/', 'bar']
26
+ ['/v2/foo', '/bar'],
27
+ ['/v2/foo/bar', ''],
26
28
  ])
27
29
  })
28
30
 
@@ -10,7 +10,7 @@ import { removeQueryStringAndFragment } from './utils/HttpIncomingMessage.js'
10
10
  export class MockBroker {
11
11
  file = '' // selected mock filename
12
12
  mocks = [] // filenames
13
- isStatic = false // doesn’t follow filename convention
13
+ isStatic = false // static means it doesn’t follow filename convention
14
14
  delayed = false
15
15
  proxied = false
16
16
  status = -1
@@ -42,6 +42,6 @@ describe('CLI', () => {
42
42
  equal(status, 0)
43
43
  })
44
44
 
45
- // Mockaton.test.js tests the remaining cli branch
45
+ // Mockaton.test.js tests the remaining cli branches
46
46
  })
47
47
 
@@ -72,7 +72,7 @@ export function unregisterMock(file) {
72
72
  function filesInDir(dir) {
73
73
  const files = []
74
74
  forEachBroker(b => {
75
- files.push(...(b.mocks.filter(m => m.startsWith(dir + '/'))))
75
+ files.push(...b.mocks.filter(m => m.startsWith(dir + '/')))
76
76
  })
77
77
  return files
78
78
  }
@@ -98,7 +98,9 @@ export function brokerByRoute(method, url) {
98
98
 
99
99
  // TODO Verify
100
100
  if (method === 'GET') {
101
- const indexUrl = url.endsWith('/') ? url + 'index.html' : url + '/index.html'
101
+ const indexUrl = url.endsWith('/')
102
+ ? url + 'index.html'
103
+ : url + '/index.html'
102
104
  for (let i = brokers.length - 1; i >= 0; i--)
103
105
  if (brokers[i].urlMaskMatches(indexUrl))
104
106
  return brokers[i]