mockaton 8.20.0 → 8.20.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.
@@ -4,7 +4,13 @@ import { METHODS } from 'node:http'
4
4
  export const SUPPORTED_METHODS = METHODS
5
5
  export const methodIsSupported = method => SUPPORTED_METHODS.includes(method)
6
6
 
7
- export class BodyReaderError extends Error {name = 'BodyReaderError'}
7
+ export class BodyReaderError extends Error {
8
+ name = 'BodyReaderError'
9
+ constructor(msg) {
10
+ super()
11
+ this.message = msg
12
+ }
13
+ }
8
14
 
9
15
  export const parseJSON = req => readBody(req, JSON.parse)
10
16
 
@@ -31,13 +37,13 @@ export function readBody(req, parser = a => a) {
31
37
  req.removeListener('end', onEnd)
32
38
  req.removeListener('error', onEnd)
33
39
  if (lengthSoFar !== expectedLength)
34
- reject(new BodyReaderError())
40
+ reject(new BodyReaderError('Length mismatch'))
35
41
  else
36
42
  try {
37
43
  resolve(parser(Buffer.concat(body).toString()))
38
44
  }
39
45
  catch (_) {
40
- reject(new BodyReaderError())
46
+ reject(new BodyReaderError('Could not parse'))
41
47
  }
42
48
  }
43
49
  })
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg version="1.1" viewBox="0 0 570 100" xmlns="http://www.w3.org/2000/svg">
3
- <style>
4
- :root { --color: #000000; }
5
- @media (prefers-color-scheme: light) { :root { --color: #444 } }
6
- @media (prefers-color-scheme: dark) { :root { --color: #eee } }
7
- path { fill: var(--color) }
8
- </style>
9
- <path
10
- d="m88.6 11.5v82.2c0 3.75-2.37 5.72-7.1 5.72s-7.1-1.97-7.1-5.72v-61.5c-0.0468-1.83-2.74-2.4-3.45-0.355l-19.7 63.1c-0.907 2.86-3.15 4.14-6.51 4.04-1.48-0.0779-2.86-0.463-3.94-1.18-1.18-0.7-1.97-1.77-2.27-3.15-4.54-15.1-9.2-30.3-13.9-45.4-1.77-5.72-3.65-12.8-5.72-19.7-0.741-1.97-3.33-2.17-3.45 0.473v63.6c0 3.75-2.37 5.72-7.1 5.72-4.73 0-7.1-1.97-7.1-5.72v-84.3c0-2.34 1.07-5.37 3.83-6.65 3.06-1.28 6.12-1.65 8.88-1.55 1.28 0 2.46 0.28 3.65 0.596 1.28 0.325 2.46 0.808 3.55 1.48 1.08 0.562 2.17 1.28 3.06 2.27 0.907 0.907 1.58 1.97 2.07 3.15l18.7 64.1c1.89-6.49 13.2-47.7 13.6-49.3 1.68-5.62 3.15-10.8 4.44-15.8 0.473-1.08 1.18-2.17 2.07-3.06 0.877-0.877 1.87-1.68 3.06-2.17 1.08-0.641 2.27-1.18 3.45-1.48 1.28-0.325 3.85-0.403 4.94-0.403 4.75 0.438 12 3.73 12 11zm21.1 18.6c2.07-1.38 4.14-2.56 6.41-3.45 2.27-0.877 4.44-1.38 6.51-1.38h19.7c2.07 0 4.14 0.454 6.41 1.38 2.27 0.907 4.44 2.07 6.45 3.5 2.01 1.43 3.59 3.4 4.67 5.96 1.08 2.46 1.68 5.23 1.68 8.48v34.5c0 6.51-2.17 11.8-6.51 14.8-4.24 3.06-8.48 4.54-12.8 4.54h-19.7c-2.07 0-4.14-0.355-6.41-1.08-2.27-0.71-4.34-1.87-6.41-3.45-4.34-3.06-6.51-7.89-6.51-14.8v-34.5c0-3.25 0.552-6.01 1.68-8.48 1.08-2.46 2.76-4.44 4.85-6.01zm30.4 56.2c3.06 0 5.03-0.848 6.21-2.56 1.28-1.68 1.97-3.45 1.97-5.42v-34.5c0-2.07-0.651-3.75-1.97-5.42-1.28-1.68-3.35-2.56-6.21-2.56h-14.8c-3.06 0-5.13 0.848-6.41 2.56-1.28 1.68-1.87 3.45-1.87 5.42v34.5c0 1.97 0.611 3.75 1.87 5.42 1.28 1.68 3.45 2.56 6.41 2.56zm94.6-7.79c0 6.51-2.17 11.8-6.51 14.8-4.24 3.06-8.48 4.54-12.8 4.54h-20.7c-4.24 0-8.48-1.58-12.8-4.54-1.97-1.68-3.45-3.55-4.44-6.01-0.986-2.46-1.58-5.32-1.58-8.58v-34.5c0-6.51 2.07-11.8 6.01-14.8 2.07-1.48 4.04-2.56 6.11-3.45 2.17-0.907 4.14-1.38 6.21-1.38h20.7c1.97 0 4.04 0.384 6.41 1.18 2.37 0.71 4.44 1.77 6.51 3.06 1.97 1.38 3.45 3.25 4.54 5.62 1.28 2.46 1.87 5.23 1.87 8.58v6.01c0 3.75-2.27 5.72-6.61 5.72s-6.61-1.97-6.61-5.72v-5.13c0-2.07-0.651-3.75-1.97-5.42-1.28-1.68-3.35-2.56-6.21-2.56h-14.8c-3.06 0-5.13 0.848-6.41 2.56-1.28 1.68-1.87 3.45-1.87 5.42v34.5c0 1.97 0.611 3.75 1.87 5.42 1.28 1.68 3.45 2.56 6.41 2.56h14.8c3.06 0 5.03-0.848 6.21-2.56 1.28-1.68 1.97-3.45 1.97-5.42v-5.52c0-3.75 2.27-5.62 6.61-5.62s6.61 1.87 6.61 5.62zm60.5-54.7c0.779 0 1.58 0.207 2.27 0.601 0.779 0.325 1.68 0.808 3.05 1.98s2.36 2.75 2.36 4.23c0 0.562-0.118 1.18-0.355 1.97-0.246 0.641-0.631 1.18-1.18 1.68l-37.5 43.4v15.8c0 3.75-2.27 5.62-6.61 5.62s-6.61-1.87-6.61-5.62v-85.8c0-3.75 2.27-5.72 6.61-5.72s6.61 1.97 6.61 5.72v50.3c2.07-2.46 4.14-4.93 6.61-7.69 2.46-2.86 4.83-5.62 7.3-8.48 2.46-2.96 4.83-5.72 7.3-8.48 2.46-2.86 4.63-5.32 6.62-7.8 0.656-0.789 2.13-1.68 3.51-1.68zm8.4 64.8c0.562 1.08 0.848 2.17 0.848 3.25 0 2.07-1.18 3.55-3.55 4.63-1.68 0.976-3.15 1.48-4.34 1.48-0.907 0-1.77-0.325-2.56-0.966-0.779-0.562-1.48-1.28-1.97-2.17l-11.8-23.7c-0.71-1.28-1.08-2.46-1.08-3.55 0-2.07 1.08-3.65 3.15-5.03 0.562-0.394 1.08-0.759 1.68-1.08 0.641-0.325 1.38-0.552 2.07-0.72 0.907-0.168 1.77-0.0033 2.56 0.473 0.779 0.473 1.48 1.18 2.07 1.97zm29.6 8.08c-2.46 0-4.83-0.325-7.1-0.966-2.27-0.71-4.44-1.77-7.44-3.59-3.01-1.81-4.98-6.35-4.98-13.2v-5.92c0-3.35 0.552-6.11 1.68-8.58 1.28-2.46 2.96-4.44 4.92-5.87 1.96-1.43 4.03-2.42 6.3-3.11 2.27-0.71 4.44-1.08 6.51-1.08h26.6v-10.8c0-2.07-0.651-3.75-1.97-5.42-1.28-1.68-3.35-2.56-6.21-2.56h-13.8c-3.06 0-5.13 0.749-6.41 2.27-1.08 1.48-1.68 3.15-1.68 5.13v0.966c0 4.14-2.27 6.21-6.7 6.21s-6.7-2.07-6.7-6.21v-1.08c0-3.35 0.552-6.01 1.68-8.28 1.28-2.27 2.86-4.14 4.73-5.62h-0.118c2.07-1.38 4.24-2.56 6.51-3.45 2.37-0.907 4.54-1.38 6.61-1.38h18.7c2.07 0 4.14 0.454 6.41 1.38 2.37 0.907 4.44 2.07 6.51 3.45h-0.118c2.07 1.48 3.65 3.45 4.73 6.01 1.08 2.46 1.68 5.23 1.68 8.48v48.3c0 3.75-2.27 5.72-6.61 5.72-0.907 0-1.77-0.0394-2.56-0.118-0.71-0.0779-1.38-0.286-2.07-0.601-0.562-0.394-1.08-0.927-1.48-1.58-0.325-0.71-0.473-1.68-0.473-2.76l-0.118-26.6h-24.6c-1.77 0-3.15 0.207-4.04 0.601-4.09 1.83-4.1 7.7-4.1 7.79v4.63c0 2.07 0.611 3.65 1.87 4.73 1.28 1.08 3.45 1.58 6.51 1.58h13.8c3.06 0 4.44 1.87 4.44 5.62 0 1.68-0.355 3.06-1.08 4.04-0.71 1.08-1.87 1.58-3.45 1.58zm71-61.1v43.4c0 2.07 0.454 3.65 1.38 4.73 0.907 1.08 2.86 1.68 5.62 1.68h3.15c3.15 0 4.54 1.87 4.44 5.52 0 3.75-1.48 5.62-4.44 5.62h-3.94c-2.66 0-4.93-0.325-7.2-0.966-2.27-0.71-4.44-1.77-6.51-3.06v0.118c-3.94-2.66-5.92-7.1-5.92-13.8v-43.4h-4.63c-2.96 0-4.44-1.87-4.54-5.62 0-3.75 1.58-5.62 4.54-5.62h4.63v-12.8c0-3.75 2.27-5.72 6.8-5.72 4.34 0 6.61 1.97 6.61 5.72v12.8h9.76c3.15 0 4.54 1.87 4.44 5.62 0 3.75-1.48 5.62-4.44 5.62zm37.8-10.4c2.27-0.877 4.44-1.38 6.51-1.38h19.7c2.07 0 4.14 0.454 6.41 1.38 2.27 0.907 4.44 2.07 6.45 3.5 2.01 1.43 3.59 3.4 4.67 5.96 1.08 2.46 1.68 5.23 1.68 8.48v34.5c0 6.51-2.17 11.8-6.51 14.8-4.24 3.06-8.48 4.54-12.8 4.54h-19.7c-2.07 0-4.14-0.355-6.41-1.08-2.27-0.71-4.34-1.87-6.41-3.45-4.34-3.06-6.51-7.89-6.51-14.8v-34.5c0-3.25 0.552-6.01 1.68-8.48 1.08-2.46 2.76-4.44 4.84-5.92s4.15-2.66 6.42-3.55zm24 59.6c3.06 0 5.03-0.848 6.21-2.56 1.28-1.68 1.97-3.45 1.97-5.42v-34.5c0-2.07-0.651-3.75-1.97-5.42-1.28-1.68-3.35-2.56-6.21-2.56h-14.8c-3.06 0-5.13 0.848-6.41 2.56-1.28 1.68-1.87 3.45-1.87 5.42v34.5c0 1.97 0.611 3.75 1.87 5.42 1.28 1.68 3.45 2.56 6.41 2.56zm72.6-50.2h-14.8c-3.35 0-5.42 0.976-6.51 2.96-1.08 1.68-1.68 3.65-1.68 5.92l-0.315 47.3c0 3.75-2.27 5.72-6.61 5.72-4.34 0-6.61-1.97-6.61-5.72v-48.3c0-3.35 0.513-6.11 1.58-8.58 1.08-2.46 2.76-4.34 4.93-5.92 4.24-3.06 8.48-4.54 12.8-4.54h19.7c4.04 0 8.28 1.58 12.8 4.54 4.34 3.06 6.51 7.89 6.51 14.8v48.3c0 3.75-2.27 5.72-6.61 5.72s-6.61-1.97-6.61-5.72v-47.3c0-2.07-0.651-4.04-1.99-6.11-1.34-2.07-3.51-3.06-6.66-3.06z"
11
- aria-label="Mockaton"/>
12
- </svg>