@mbtest/mountebank 2.9.2-beta.9050

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.
Files changed (207) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +94 -0
  3. package/bin/mb +136 -0
  4. package/package.json +71 -0
  5. package/releases.json +52 -0
  6. package/src/cli/api.js +112 -0
  7. package/src/cli/cli.js +420 -0
  8. package/src/controllers/configController.js +64 -0
  9. package/src/controllers/feedController.js +115 -0
  10. package/src/controllers/homeController.js +58 -0
  11. package/src/controllers/imposterController.js +328 -0
  12. package/src/controllers/impostersController.js +215 -0
  13. package/src/controllers/logsController.js +52 -0
  14. package/src/models/behaviors.js +553 -0
  15. package/src/models/behaviorsValidator.js +186 -0
  16. package/src/models/compatibility.js +133 -0
  17. package/src/models/dryRunValidator.js +261 -0
  18. package/src/models/filesystemBackedImpostersRepository.js +908 -0
  19. package/src/models/http/baseHttpServer.js +207 -0
  20. package/src/models/http/headersMap.js +87 -0
  21. package/src/models/http/httpProxy.js +230 -0
  22. package/src/models/http/httpRequest.js +82 -0
  23. package/src/models/http/httpServer.js +18 -0
  24. package/src/models/http/index.js +18 -0
  25. package/src/models/https/cert/mb-cert.pem +20 -0
  26. package/src/models/https/cert/mb-csr.pem +16 -0
  27. package/src/models/https/cert/mb-key.pem +27 -0
  28. package/src/models/https/httpsServer.js +42 -0
  29. package/src/models/https/index.js +18 -0
  30. package/src/models/imposter.js +243 -0
  31. package/src/models/imposterPrinter.js +120 -0
  32. package/src/models/impostersRepository.js +49 -0
  33. package/src/models/inMemoryImpostersRepository.js +418 -0
  34. package/src/models/jsonpath.js +44 -0
  35. package/src/models/mbConnection.js +107 -0
  36. package/src/models/predicates.js +438 -0
  37. package/src/models/protocols.js +242 -0
  38. package/src/models/responseResolver.js +398 -0
  39. package/src/models/smtp/index.js +16 -0
  40. package/src/models/smtp/smtpRequest.js +60 -0
  41. package/src/models/smtp/smtpServer.js +109 -0
  42. package/src/models/tcp/index.js +18 -0
  43. package/src/models/tcp/tcpProxy.js +110 -0
  44. package/src/models/tcp/tcpRequest.js +23 -0
  45. package/src/models/tcp/tcpServer.js +156 -0
  46. package/src/models/tcp/tcpValidator.js +19 -0
  47. package/src/models/xpath.js +95 -0
  48. package/src/mountebank.js +245 -0
  49. package/src/public/images/arrow_down.png +0 -0
  50. package/src/public/images/arrow_up.png +0 -0
  51. package/src/public/images/book.jpg +0 -0
  52. package/src/public/images/dataflow.png +0 -0
  53. package/src/public/images/favicon.ico +0 -0
  54. package/src/public/images/forkme_right_orange_ff7600.png +0 -0
  55. package/src/public/images/mountebank.png +0 -0
  56. package/src/public/images/overview.gif +0 -0
  57. package/src/public/images/quote.png +0 -0
  58. package/src/public/images/tw-logo.png +0 -0
  59. package/src/public/scripts/jquery/jquery-3.6.1.min.js +2 -0
  60. package/src/public/scripts/urlHashHandler.js +31 -0
  61. package/src/public/stylesheets/application.css +424 -0
  62. package/src/public/stylesheets/ie.css +14 -0
  63. package/src/public/stylesheets/imposters.css +121 -0
  64. package/src/public/stylesheets/jqueryui/1.10.4/themes/smoothness/jquery-ui.css +1178 -0
  65. package/src/util/combinators.js +68 -0
  66. package/src/util/date.js +51 -0
  67. package/src/util/errors.js +55 -0
  68. package/src/util/helpers.js +131 -0
  69. package/src/util/inherit.js +28 -0
  70. package/src/util/ip.js +54 -0
  71. package/src/util/logger.js +83 -0
  72. package/src/util/middleware.js +256 -0
  73. package/src/util/scopedLogger.js +47 -0
  74. package/src/views/_footer.ejs +20 -0
  75. package/src/views/_header.ejs +113 -0
  76. package/src/views/_imposter.ejs +8 -0
  77. package/src/views/config.ejs +71 -0
  78. package/src/views/docs/api/behaviors/copy.ejs +427 -0
  79. package/src/views/docs/api/behaviors/decorate.ejs +182 -0
  80. package/src/views/docs/api/behaviors/lookup.ejs +220 -0
  81. package/src/views/docs/api/behaviors/shellTransform.ejs +153 -0
  82. package/src/views/docs/api/behaviors/wait.ejs +121 -0
  83. package/src/views/docs/api/behaviors.ejs +141 -0
  84. package/src/views/docs/api/contracts/addStub-description.ejs +10 -0
  85. package/src/views/docs/api/contracts/addStub.ejs +10 -0
  86. package/src/views/docs/api/contracts/config-description.ejs +32 -0
  87. package/src/views/docs/api/contracts/config.ejs +23 -0
  88. package/src/views/docs/api/contracts/home-description.ejs +18 -0
  89. package/src/views/docs/api/contracts/home.ejs +13 -0
  90. package/src/views/docs/api/contracts/imposter-description.ejs +439 -0
  91. package/src/views/docs/api/contracts/imposter.ejs +182 -0
  92. package/src/views/docs/api/contracts/imposters-description.ejs +13 -0
  93. package/src/views/docs/api/contracts/imposters.ejs +13 -0
  94. package/src/views/docs/api/contracts/logs-description.ejs +3 -0
  95. package/src/views/docs/api/contracts/logs.ejs +14 -0
  96. package/src/views/docs/api/contracts/stub-description.ejs +4 -0
  97. package/src/views/docs/api/contracts/stub.ejs +7 -0
  98. package/src/views/docs/api/contracts/stubs-description.ejs +4 -0
  99. package/src/views/docs/api/contracts/stubs.ejs +11 -0
  100. package/src/views/docs/api/contracts.ejs +133 -0
  101. package/src/views/docs/api/errors.ejs +64 -0
  102. package/src/views/docs/api/fault/connectionReset.ejs +31 -0
  103. package/src/views/docs/api/fault/randomDataThenClose.ejs +31 -0
  104. package/src/views/docs/api/faults.ejs +57 -0
  105. package/src/views/docs/api/injection.ejs +426 -0
  106. package/src/views/docs/api/json.ejs +205 -0
  107. package/src/views/docs/api/jsonpath.ejs +210 -0
  108. package/src/views/docs/api/mocks.ejs +130 -0
  109. package/src/views/docs/api/overview.ejs +968 -0
  110. package/src/views/docs/api/predicates/and.ejs +62 -0
  111. package/src/views/docs/api/predicates/contains.ejs +64 -0
  112. package/src/views/docs/api/predicates/deepEquals.ejs +114 -0
  113. package/src/views/docs/api/predicates/endsWith.ejs +66 -0
  114. package/src/views/docs/api/predicates/equals.ejs +125 -0
  115. package/src/views/docs/api/predicates/exists.ejs +118 -0
  116. package/src/views/docs/api/predicates/inject.ejs +67 -0
  117. package/src/views/docs/api/predicates/matches.ejs +66 -0
  118. package/src/views/docs/api/predicates/not.ejs +52 -0
  119. package/src/views/docs/api/predicates/or.ejs +79 -0
  120. package/src/views/docs/api/predicates/startsWith.ejs +62 -0
  121. package/src/views/docs/api/predicates.ejs +382 -0
  122. package/src/views/docs/api/proxies.ejs +191 -0
  123. package/src/views/docs/api/proxy/addDecorateBehavior.ejs +115 -0
  124. package/src/views/docs/api/proxy/addWaitBehavior.ejs +96 -0
  125. package/src/views/docs/api/proxy/injectHeaders.ejs +91 -0
  126. package/src/views/docs/api/proxy/predicateGenerators.ejs +600 -0
  127. package/src/views/docs/api/proxy/proxyModes.ejs +495 -0
  128. package/src/views/docs/api/stubs.ejs +391 -0
  129. package/src/views/docs/api/xpath.ejs +281 -0
  130. package/src/views/docs/cli/configFiles.ejs +133 -0
  131. package/src/views/docs/cli/customFormatters.ejs +53 -0
  132. package/src/views/docs/cli/help.ejs +6 -0
  133. package/src/views/docs/cli/replay.ejs +42 -0
  134. package/src/views/docs/cli/restart.ejs +10 -0
  135. package/src/views/docs/cli/save.ejs +68 -0
  136. package/src/views/docs/cli/start.ejs +234 -0
  137. package/src/views/docs/cli/stop.ejs +32 -0
  138. package/src/views/docs/commandLine.ejs +93 -0
  139. package/src/views/docs/communityExtensions.ejs +233 -0
  140. package/src/views/docs/gettingStarted.ejs +146 -0
  141. package/src/views/docs/mentalModel.ejs +51 -0
  142. package/src/views/docs/protocols/custom.ejs +231 -0
  143. package/src/views/docs/protocols/http.ejs +238 -0
  144. package/src/views/docs/protocols/https.ejs +246 -0
  145. package/src/views/docs/protocols/smtp.ejs +142 -0
  146. package/src/views/docs/protocols/tcp.ejs +431 -0
  147. package/src/views/docs/security.ejs +38 -0
  148. package/src/views/faqs.ejs +65 -0
  149. package/src/views/feed.ejs +33 -0
  150. package/src/views/imposter.ejs +22 -0
  151. package/src/views/imposters.ejs +33 -0
  152. package/src/views/index.ejs +89 -0
  153. package/src/views/license.ejs +30 -0
  154. package/src/views/logs.ejs +77 -0
  155. package/src/views/releases/v1.1.0.ejs +55 -0
  156. package/src/views/releases/v1.1.36.ejs +84 -0
  157. package/src/views/releases/v1.1.72.ejs +92 -0
  158. package/src/views/releases/v1.10.0.ejs +108 -0
  159. package/src/views/releases/v1.11.0.ejs +109 -0
  160. package/src/views/releases/v1.12.0.ejs +96 -0
  161. package/src/views/releases/v1.13.0.ejs +118 -0
  162. package/src/views/releases/v1.14.0.ejs +107 -0
  163. package/src/views/releases/v1.14.1.ejs +94 -0
  164. package/src/views/releases/v1.15.0.ejs +113 -0
  165. package/src/views/releases/v1.16.0.ejs +104 -0
  166. package/src/views/releases/v1.2.0.ejs +78 -0
  167. package/src/views/releases/v1.2.103.ejs +86 -0
  168. package/src/views/releases/v1.2.122.ejs +86 -0
  169. package/src/views/releases/v1.2.30.ejs +84 -0
  170. package/src/views/releases/v1.2.45.ejs +84 -0
  171. package/src/views/releases/v1.2.56.ejs +79 -0
  172. package/src/views/releases/v1.3.0.ejs +86 -0
  173. package/src/views/releases/v1.3.1.ejs +100 -0
  174. package/src/views/releases/v1.4.0.ejs +96 -0
  175. package/src/views/releases/v1.4.1.ejs +103 -0
  176. package/src/views/releases/v1.4.2.ejs +100 -0
  177. package/src/views/releases/v1.4.3.ejs +113 -0
  178. package/src/views/releases/v1.5.0.ejs +104 -0
  179. package/src/views/releases/v1.5.1.ejs +91 -0
  180. package/src/views/releases/v1.6.0.ejs +109 -0
  181. package/src/views/releases/v1.7.0.ejs +113 -0
  182. package/src/views/releases/v1.7.1.ejs +90 -0
  183. package/src/views/releases/v1.7.2.ejs +96 -0
  184. package/src/views/releases/v1.8.0.ejs +121 -0
  185. package/src/views/releases/v1.9.0.ejs +111 -0
  186. package/src/views/releases/v2.0.0.ejs +159 -0
  187. package/src/views/releases/v2.1.0.ejs +121 -0
  188. package/src/views/releases/v2.1.1.ejs +106 -0
  189. package/src/views/releases/v2.1.2.ejs +84 -0
  190. package/src/views/releases/v2.2.0.ejs +115 -0
  191. package/src/views/releases/v2.2.1.ejs +102 -0
  192. package/src/views/releases/v2.3.0.ejs +121 -0
  193. package/src/views/releases/v2.3.1.ejs +100 -0
  194. package/src/views/releases/v2.3.2.ejs +102 -0
  195. package/src/views/releases/v2.3.3.ejs +97 -0
  196. package/src/views/releases/v2.4.0.ejs +114 -0
  197. package/src/views/releases/v2.5.0.ejs +51 -0
  198. package/src/views/releases/v2.6.0.ejs +35 -0
  199. package/src/views/releases/v2.7.0.ejs +32 -0
  200. package/src/views/releases/v2.8.0.ejs +36 -0
  201. package/src/views/releases/v2.8.1.ejs +7 -0
  202. package/src/views/releases/v2.8.2.ejs +26 -0
  203. package/src/views/releases/v2.9.0.ejs +32 -0
  204. package/src/views/releases/v2.9.1.ejs +10 -0
  205. package/src/views/releases.ejs +26 -0
  206. package/src/views/sitemap.ejs +36 -0
  207. package/src/views/support.ejs +14 -0
@@ -0,0 +1,182 @@
1
+ <pre id='imposter-specification'><code>{
2
+ <span id='imposter-port'><%- indent(2) %>&quot;port&quot;: 4545,</span>
3
+ <span id='imposter-protocol'><%- indent(2) %>&quot;protocol&quot;: &quot;https&quot;,</span>
4
+ <span id='imposter-name'><%- indent(2) %>&quot;name&quot;: &quot;imposter contract service&quot;,</span>
5
+ <span id='imposter-recordRequests'><%- indent(2) %>&quot;recordRequests&quot;: &quot;true&quot;,</span>
6
+ <span id='imposter-numberOfRequests' class='response'><%- indent(2) %>&quot;numberOfRequests&quot;: &quot;1&quot;,</span>
7
+ <span id='imposter-key'><%- indent(2) %>&quot;key&quot;: &quot;-----BEGIN RSA PRIVATE KEY-----\nMIICXAIBAAKBgQCrvse04YkxtVGagyvGJCsvv7LTfLK5uR/ZIJKDYCnuF+BqBzM4\nlko8O39vx+Lz9FfF11Xl+CN1aY37YurLYOle3dC/qslSbQDe2TJN7lcVHVssePvc\nO5IExpvNFV5LYtmyCMKJHxpnIprv/trUso5obqzzXhFVPV9SQbFH/snInwIDAQAB\nAoGARywlqLD6YO4qJiULw+4DM6N2oSwBCPRN3XYhIW59kdy1NFtNf7rQgsuJUTJ9\nu+lbYnKNd2LwltyqaS4h7Sx5KRhpFNmMpyVsBf5J2q3fbfmrsXt+emY7XhVTc1NV\nizUWYyxCoTTeMWvN/6NYpPV0lSxq7jMTFVZrWQUMqJclxpECQQDTlGwALtAX1Y8u\nGKsEHPkoq9bhHA5N9WAboQ4LQCZVC8eBf/XH//2iosYTXRNgII2JLmHmmxJHo5iN\nJPFMbnoHAkEAz81osJf+yHm7PBBJP4zEWZCV25c+iJiPDpj5UoUXEbq47qVfy1mV\nDqy2zoDynAWitU7PeHyZ8ozfyribPoR2qQJAVmvMhXKZmvKnLivzRpXTC9LMzVwZ\nV6x/Wim5w8yrG5fZIMM0kEG2xwR3pZch/+SsCzl/0aLLn6lp+VT6nr6NZwJBAMxs\nHrvymoLvNeDtiJFK0nHliXafP7YyljDfDg4+vSYE0R57c1RhSQBJqgBV29TeumSw\nJes6cFuqeBE+MAJ9XxkCQDdUdhnA8HHQRNetqK7lygUep7EcHHCB6u/0FypoLw7o\nEUVo5KSEFq93UeMr3B7DDPIz3LOrFXlm7clCh1HFZhQ=\n-----END RSA PRIVATE KEY-----&quot;,</span>
8
+ <span id='imposter-cert'><%- indent(2) %>&quot;cert&quot;: &quot;-----BEGIN CERTIFICATE-----\nMIIB6TCCAVICCQCZgxbBD0CG4zANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJV\nUzETMBEGA1UECBMKU29tZS1TdGF0ZTEVMBMGA1UEChMMVGhvdWdodFdvcmtzMB4X\nDTEzMTIyOTE2NDAzN1oXDTE0MDEyODE2NDAzN1owOTELMAkGA1UEBhMCVVMxEzAR\nBgNVBAgTClNvbWUtU3RhdGUxFTATBgNVBAoTDFRob3VnaHRXb3JrczCBnzANBgkq\nhkiG9w0BAQEFAAOBjQAwgYkCgYEAq77HtOGJMbVRmoMrxiQrL7+y03yyubkf2SCS\ng2Ap7hfgagczOJZKPDt/b8fi8/RXxddV5fgjdWmN+2Lqy2DpXt3Qv6rJUm0A3tky\nTe5XFR1bLHj73DuSBMabzRVeS2LZsgjCiR8aZyKa7/7a1LKOaG6s814RVT1fUkGx\nR/7JyJ8CAwEAATANBgkqhkiG9w0BAQUFAAOBgQCPhixeKxIy+ftrfPikwjYo1uxp\ngQ18FdVN1pbI//IIx1o8kJuX8yZzO95PsCOU0GbIRCkFMhBlqHiD9H0/W/GvWzjf\n7WFW15lL61y/kH1J0wqEgoaMrUDjHZvKVr0HrN+vSxHlNQcSNFJ2KdvZ5a9dhpGf\nXOdprCdUUXzSoJWCCg==\n-----END CERTIFICATE-----&quot;,</span>
9
+ <span id='imposter-mutualAuth'><%- indent(2) %>&quot;mutualAuth&quot;: false,</span>
10
+ <span id='imposter-defaultResponse'><%- indent(2) %>&quot;defaultResponse&quot;: {
11
+ &quot;statusCode&quot;: 400,
12
+ &quot;body&quot;: &quot;Bad Request&quot;,
13
+ &quot;headers&quot;: {}
14
+ },</span>
15
+ <span id='imposter-stubs'><%- indent(2) %>&quot;stubs&quot;: [</span>
16
+ {
17
+ <span id='imposter-stubs-responses'><%- indent(6) %>&quot;responses&quot;: [</span>
18
+ {
19
+ <span id='imposter-stubs-responses-is'><%- indent(10) %>&quot;is&quot;: {
20
+ &quot;statusCode&quot;: 201,
21
+ &quot;headers&quot;: {
22
+ &quot;Location&quot;: &quot;http://example.com/resource&quot;
23
+ },
24
+ &quot;body&quot;: &quot;The time is ${TIME}&quot;,
25
+ &quot;_mode&quot;: &quot;text&quot;
26
+ },</span>
27
+ <span id='imposter-stubs-responses-repeat'><%- indent(10) %>&quot;repeat&quot;: 3,</span>
28
+ <span id='imposter-stubs-behaviors'><%- indent(10) %>&quot;behaviors&quot;: [</span>
29
+ <span id='imposter-stubs-behaviors-wait'><%- indent(12) %>{ &quot;wait&quot;: 500 },</span>
30
+ <span id='imposter-stubs-behaviors-decorate'><%- indent(12) %>{ &quot;decorate&quot;: &quot;config => { config.response.body = config.response.body.replace('${TIME}', 'now'); }&quot; },</span>
31
+ <span id='imposter-stubs-behaviors-shellTransform'><%- indent(12) %>{ &quot;shellTransform&quot;: &quot;transformResponse&quot; },</span>
32
+ <span id='imposter-stubs-behaviors-copy'><%- indent(12) %>{
33
+ &quot;copy&quot;: {
34
+ &quot;from&quot;: &quot;body&quot;,
35
+ &quot;into&quot;: &quot;${NAME}&quot;,
36
+ &quot;using&quot;: {
37
+ &quot;method&quot;: &quot;xpath&quot;,
38
+ &quot;selector&quot;: &quot;//test:name&quot;,
39
+ &quot;ns&quot;: { &quot;test&quot;: &quot;http://example.com/test&quot; }
40
+ }
41
+ }
42
+ },</span>
43
+ <span id='imposter-stubs-behaviors-lookup'><%- indent(12) %>{
44
+ &quot;lookup&quot;: {
45
+ &quot;key&quot;: {
46
+ &quot;from&quot;: { &quot;headers&quot;: &quot;If-Modified-Since&quot; },
47
+ &quot;using&quot;: {
48
+ &quot;method&quot;: &quot;regex&quot;,
49
+ &quot;selector&quot;: &quot;(\\w+), (\\d+) (\\w+) (\\d+)&quot;,
50
+ &quot;options&quot;: { &quot;ignoreCase&quot;: true, &quot;multiline&quot;: true }
51
+ },
52
+ &quot;index&quot;: 2
53
+ },
54
+ &quot;fromDataSource&quot;: {
55
+ &quot;csv&quot;: {
56
+ &quot;path&quot;: &quot;values.csv&quot;,
57
+ &quot;keyColumn&quot;: &quot;month&quot;,
58
+ &quot;delimiter&quot;: &quot;,&quot;
59
+ }
60
+ },
61
+ &quot;into&quot;: &quot;${row}&quot;
62
+ }
63
+ }</span>
64
+ ]
65
+ },
66
+ {
67
+ <span id='imposter-stubs-responses-proxy'><%- indent(10) %>&quot;proxy&quot;: {</span>
68
+ <span id='imposter-stubs-responses-proxy-to'><%- indent(12) %>&quot;to&quot;: &quot;https://www.somesite.com:3000&quot;,</span>
69
+ <span id='imposter-stubs-responses-proxy-mode'><%- indent(12) %>&quot;mode&quot;: &quot;proxyAlways&quot;,</span>
70
+ <span id='imposter-stubs-responses-proxy-key'><%- indent(12) %>&quot;key&quot;: &quot;-----BEGIN RSA PRIVATE KEY-----\nMIICXAIBAAKBgQCrvse04YkxtVGagyvGJCsvv7LTfLK5uR/ZIJKDYCnuF+BqBzM4\nlko8O39vx+Lz9FfF11Xl+CN1aY37YurLYOle3dC/qslSbQDe2TJN7lcVHVssePvc\nO5IExpvNFV5LYtmyCMKJHxpnIprv/trUso5obqzzXhFVPV9SQbFH/snInwIDAQAB\nAoGARywlqLD6YO4qJiULw+4DM6N2oSwBCPRN3XYhIW59kdy1NFtNf7rQgsuJUTJ9\nu+lbYnKNd2LwltyqaS4h7Sx5KRhpFNmMpyVsBf5J2q3fbfmrsXt+emY7XhVTc1NV\nizUWYyxCoTTeMWvN/6NYpPV0lSxq7jMTFVZrWQUMqJclxpECQQDTlGwALtAX1Y8u\nGKsEHPkoq9bhHA5N9WAboQ4LQCZVC8eBf/XH//2iosYTXRNgII2JLmHmmxJHo5iN\nJPFMbnoHAkEAz81osJf+yHm7PBBJP4zEWZCV25c+iJiPDpj5UoUXEbq47qVfy1mV\nDqy2zoDynAWitU7PeHyZ8ozfyribPoR2qQJAVmvMhXKZmvKnLivzRpXTC9LMzVwZ\nV6x/Wim5w8yrG5fZIMM0kEG2xwR3pZch/+SsCzl/0aLLn6lp+VT6nr6NZwJBAMxs\nHrvymoLvNeDtiJFK0nHliXafP7YyljDfDg4+vSYE0R57c1RhSQBJqgBV29TeumSw\nJes6cFuqeBE+MAJ9XxkCQDdUdhnA8HHQRNetqK7lygUep7EcHHCB6u/0FypoLw7o\nEUVo5KSEFq93UeMr3B7DDPIz3LOrFXlm7clCh1HFZhQ=\n-----END RSA PRIVATE KEY-----&quot;,</span>
71
+ <span id='imposter-stubs-responses-proxy-cert'><%- indent(12) %>&quot;cert&quot;: &quot;-----BEGIN CERTIFICATE-----\nMIIB6TCCAVICCQCZgxbBD0CG4zANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJV\nUzETMBEGA1UECBMKU29tZS1TdGF0ZTEVMBMGA1UEChMMVGhvdWdodFdvcmtzMB4X\nDTEzMTIyOTE2NDAzN1oXDTE0MDEyODE2NDAzN1owOTELMAkGA1UEBhMCVVMxEzAR\nBgNVBAgTClNvbWUtU3RhdGUxFTATBgNVBAoTDFRob3VnaHRXb3JrczCBnzANBgkq\nhkiG9w0BAQEFAAOBjQAwgYkCgYEAq77HtOGJMbVRmoMrxiQrL7+y03yyubkf2SCS\ng2Ap7hfgagczOJZKPDt/b8fi8/RXxddV5fgjdWmN+2Lqy2DpXt3Qv6rJUm0A3tky\nTe5XFR1bLHj73DuSBMabzRVeS2LZsgjCiR8aZyKa7/7a1LKOaG6s814RVT1fUkGx\nR/7JyJ8CAwEAATANBgkqhkiG9w0BAQUFAAOBgQCPhixeKxIy+ftrfPikwjYo1uxp\ngQ18FdVN1pbI//IIx1o8kJuX8yZzO95PsCOU0GbIRCkFMhBlqHiD9H0/W/GvWzjf\n7WFW15lL61y/kH1J0wqEgoaMrUDjHZvKVr0HrN+vSxHlNQcSNFJ2KdvZ5a9dhpGf\nXOdprCdUUXzSoJWCCg==\n-----END CERTIFICATE-----&quot;,</span>
72
+ <span id='imposter-stubs-responses-proxy-ciphers'><%- indent(12) %>&quot;ciphers&quot;: &quot;RC4-MD5&quot;,</span>
73
+ <span id='imposter-stubs-responses-proxy-secureProtocol'><%- indent(12) %>&quot;secureProtocol&quot;: &quot;TLSv1_1_method&quot;,</span>
74
+ <span id='imposter-stubs-responses-proxy-passphrase'><%- indent(12) %>&quot;passphrase&quot;: &quot;LetMeIn!&quot;,</span>
75
+ <span id='imposter-stubs-responses-proxy-addWaitBehavior'><%- indent(12) %>&quot;addWaitBehavior&quot;: &quot;true&quot;,</span>
76
+ <span id='imposter-stubs-responses-proxy-addDecorateBehavior'><%- indent(12) %>&quot;addDecorateBehavior&quot;: &quot;(request, response) => { response.body = response.body.replace('${TIME}', 'now'); }&quot;,</span>
77
+ <span id='imposter-stubs-responses-proxy-predicateGenerators'><%- indent(12) %>&quot;predicateGenerators&quot;: [
78
+ {
79
+ &quot;matches&quot;: {
80
+ &quot;path&quot;: true
81
+ },
82
+ &quot;caseSensitive&quot;: true,
83
+ &quot;except&quot;: &quot;^The^&quot;,
84
+ &quot;jsonpath&quot;: {
85
+ &quot;selector&quot;: &quot;$..book&quot;
86
+ },
87
+ &quot;xpath&quot;: {
88
+ &quot;selector&quot;: &quot;//book/@title&quot;,
89
+ &quot;ns&quot;: {
90
+ &quot;isbn&quot;: &quot;http://schemas.isbn.org/ns/1999/basic.dtd&quot;
91
+ }
92
+ },
93
+ &quot;inject&quot;: &quot;function (config) { return []; }&quot;,
94
+ &quot;ignore&quot;: { &quot;query&quot;: &quot;startDate&quot; }
95
+ }
96
+ ],</span>
97
+ <span id='imposter-stubs-responses-proxy-injectHeaders'><%- indent(12) %>&quot;injectHeaders&quot;: {
98
+ &quot;X-Custom-Header&quot;: &quot;Served by mountebank&quot;
99
+ }</span>
100
+ }
101
+ },
102
+ {
103
+ <span id='imposter-stubs-responses-inject'><%- indent(10) %>&quot;inject&quot;: &quot;function (config) { config.callback({ body: 'It worked!' }); }&quot;</span>
104
+ }
105
+ ],
106
+ <span id='imposter-stubs-predicates'><%- indent(6) %>&quot;predicates&quot;: [</span>
107
+ {
108
+ <span id='imposter-stubs-predicates-0-equals'><%- indent(10) %>&quot;equals&quot;: {
109
+ &quot;body&quot;: &quot;value&quot;
110
+ },</span>
111
+ <span id='imposter-stubs-predicates-0-caseSensitive'><%- indent(10) %>&quot;caseSensitive&quot;: true,</span>
112
+ <span id='imposter-stubs-predicates-0-except'><%- indent(10) %>&quot;except&quot;: &quot;^The &quot;,</span>
113
+ <span id='imposter-stubs-predicates-0-jsonpath'><%- indent(10) %>&quot;jsonpath&quot;: {
114
+ &quot;selector&quot;: &quot;$..book&quot;
115
+ },</span>
116
+ <span id='imposter-stubs-predicates-0-xpath'><%- indent(10) %>&quot;xpath&quot;: {
117
+ &quot;selector&quot;: &quot;//book/@title&quot;,
118
+ &quot;ns&quot;: {
119
+ &quot;isbn&quot;: &quot;http://schemas.isbn.org/ns/1999/basic.dtd&quot;
120
+ }</span>
121
+ }
122
+ },
123
+ {
124
+ <span id='imposter-stubs-predicates-1-inject'><%- indent(10) %>&quot;inject&quot;: &quot;function (config) { return config.request.body.length &lt; 100; }&quot;</span>
125
+ }
126
+ ],
127
+ <span id='imposter-stubs-matches' class='response'><%- indent(6) %>&quot;matches&quot;: [
128
+ {
129
+ &quot;timestamp&quot;: &quot;2014-01-09T02:30:31.043Z&quot;,
130
+ &quot;request&quot;: {
131
+ &quot;requestFrom&quot;: &quot;::ffff:127.0.0.1:60523&quot;,
132
+ &quot;method&quot;: &quot;POST&quot;,
133
+ &quot;path&quot;: &quot;/imposters&quot;,
134
+ &quot;query&quot;: {},
135
+ &quot;headers&quot;: {
136
+ &quot;accept&quot;: &quot;text/plain&quot;,
137
+ &quot;host&quot;: &quot;localhost:4545&quot;,
138
+ &quot;content-type&quot;: &quot;application/xml&quot;,
139
+ &quot;connection&quot;: &quot;keep-alive&quot;,
140
+ &quot;transfer-encoding&quot;: &quot;chunked&quot;
141
+ },
142
+ &quot;body&quot;: &quot;&lt;books&gt;&lt;book title='The value' /&gt;&lt;/books&gt;&quot;
143
+ },
144
+ &quot;response&quot;: {
145
+ &quot;statusCode&quot;: 201,
146
+ &quot;headers&quot;: {
147
+ &quot;Location&quot;: &quot;http://example.com/resource&quot;
148
+ },
149
+ &quot;body&quot;: &quot;The time is now&quot;,
150
+ &quot;_mode&quot;: &quot;text&quot;
151
+ }
152
+ }
153
+ ]
154
+ }
155
+ ],</span>
156
+ <span id='imposter-endOfRequestResolver'><%- indent(2) %>&quot;endOfRequestResolver&quot;: {
157
+ &quot;inject&quot;: &quot;function (config) { return config.request.length &gt;= 100; }&quot;</span>
158
+ },
159
+ <span id='imposter-requests' class='response'><%- indent(2) %>&quot;requests&quot;: [
160
+ {
161
+ &quot;timestamp&quot;: &quot;2014-01-09T02:30:31.043Z&quot;,
162
+ &quot;requestFrom&quot;: &quot;::ffff:127.0.0.1:60523&quot;,
163
+ &quot;method&quot;: &quot;POST&quot;,
164
+ &quot;path&quot;: &quot;/imposters&quot;,
165
+ &quot;query&quot;: {},
166
+ &quot;headers&quot;: {
167
+ &quot;accept&quot;: &quot;text/plain&quot;,
168
+ &quot;host&quot;: &quot;localhost:4545&quot;,
169
+ &quot;content-type&quot;: &quot;text/plain&quot;,
170
+ &quot;connection&quot;: &quot;keep-alive&quot;,
171
+ &quot;transfer-encoding&quot;: &quot;chunked&quot;
172
+ },
173
+ &quot;body&quot;: &quot;Just checking&quot;
174
+ }
175
+ ],</span>
176
+ <span id='imposter-_links' class='response'><%- indent(2) %>&quot;_links&quot;: {
177
+ &quot;self&quot;: {
178
+ &quot;href&quot;: &quot;http://localhost:2525/imposters/4545&quot;</span>
179
+ }
180
+ }
181
+ }
182
+ </code></pre>
@@ -0,0 +1,13 @@
1
+ <div id='imposters-imposters-description'>
2
+ <p>An array of imposter objects.<p>
3
+ </div>
4
+
5
+ <div id='imposters-imposter-description'>
6
+ <p>A single imposter object.</p>
7
+
8
+ <p class='info-icon'>By default, the fields shown are the only ones returned. Use
9
+ additional <a href='/docs/api/overview#get-imposters'>query parameters</a> to return
10
+ the full imposter definition, and optionally remove proxies for subsequent replays</p>
11
+
12
+ <p class='info-icon'>More information: <a href='/docs/api/contracts?type=imposter'>imposter contract</a></p>
13
+ </div>
@@ -0,0 +1,13 @@
1
+ <pre id='imposters-specification'><code>{
2
+ <span id='imposters-imposters'><%- indent(2) %>&quot;imposters&quot;: [</span>
3
+ <span id='imposters-imposter'><%- indent(4) %>{
4
+ &quot;protocol&quot;: &quot;http&quot;,
5
+ &quot;port&quot;: 4546,
6
+ &quot;_links&quot;: {
7
+ &quot;self&quot;: {
8
+ &quot;href&quot;: &quot;http://localhost:2525/imposters/4546&quot;
9
+ }
10
+ }
11
+ }</span>
12
+ ]
13
+ }</code></pre>
@@ -0,0 +1,3 @@
1
+ <div id='logs-logs-description'>
2
+ <p>An array of all log statements captured in the current log file.</p>
3
+ </div>
@@ -0,0 +1,14 @@
1
+ <pre id='logs-specification'><code>{
2
+ <span id='logs-logs'><%- indent(2) %>&quot;logs&quot;: [
3
+ {
4
+ &quot;level&quot;: &quot;info&quot;,
5
+ &quot;message&quot;: &quot;[mb:2525] mountebank v1.4.1 (node v4.2.0) now taking orders - point your browser to http://localhost:2525 for help&quot;,
6
+ &quot;timestamp&quot;: &quot;2015-10-20T02:24:41.818Z&quot;
7
+ },
8
+ {
9
+ &quot;level&quot;: &quot;info&quot;,
10
+ &quot;message&quot;: &quot;[mb:2525] Adios - see you soon?&quot;,
11
+ &quot;timestamp&quot;: &quot;2015-10-20T02:31:38.109Z&quot;
12
+ }
13
+ ]</span>
14
+ }</code></pre>
@@ -0,0 +1,4 @@
1
+ <div id='stub-stub-description'>
2
+ <p>The stub to add. See the imposter contract for more information.</p>
3
+ <p class='info-icon'>More information: <a href='/docs/api/contracts?type=imposter'>imposter contract</a></p>
4
+ </div>
@@ -0,0 +1,7 @@
1
+ <pre id='stub-specification'><code>{
2
+ <span id='stub-stub'><%- indent(2) %>&quot;responses&quot;: [{
3
+ &quot;is&quot;: {
4
+ &quot;body&quot;: &quot;Hello, world!&quot;
5
+ }
6
+ }]</span>
7
+ }</code></pre>
@@ -0,0 +1,4 @@
1
+ <div id='stubs-stub-description'>
2
+ <p>The stub to add. See the imposter contract for more information.</p>
3
+ <p class='info-icon'>More information: <a href='/docs/api/contracts?type=imposter'>imposter contract</a></p>
4
+ </div>
@@ -0,0 +1,11 @@
1
+ <pre id='stubs-specification'><code>{
2
+ &quot;stubs&quot;: [
3
+ <span id='stubs-stub'><%- indent(4) %>{
4
+ &quot;responses&quot;: [{
5
+ &quot;is&quot;: {
6
+ &quot;body&quot;: &quot;Hello, world!&quot;
7
+ }
8
+ }]
9
+ }</span>
10
+ ]
11
+ }</code></pre>
@@ -0,0 +1,133 @@
1
+ <%
2
+ title = 'Contracts'
3
+ description = 'Contract specifications and descriptions'
4
+
5
+ function indent (spaces) {
6
+ var result = '';
7
+ for (let i = 0; i < spaces - 2; i++) {
8
+ result += ' ';
9
+ }
10
+ return " <a title='Click to pin documentation on the right' class='thumbtack-icon'></a>" + result;
11
+ }
12
+ %>
13
+
14
+ <%- include('../../_header') -%>
15
+
16
+ <h1>Contracts</h1>
17
+
18
+ <p>To get more details on any field, simply hover your mouse over that field. Purple fields
19
+ are only meaningful in the response; they will be ignored in any requests.</p>
20
+
21
+ <p>Showing contract for the
22
+ <select id='contract-types'>
23
+ <option value='home'>home</option>
24
+ <option value='imposters'>imposters</option>
25
+ <option value='imposter'>imposter</option>
26
+ <option value='addStub'>addStub</option>
27
+ <option value='stub'>stub</option>
28
+ <option value='stubs'>stubs</option>
29
+ <option value='config'>config</option>
30
+ <option value='logs'>logs</option>
31
+ </select> resource.</p>
32
+
33
+ <div class='contract' id='specification'>
34
+ <%- include('contracts/home', { indent }) -%>
35
+ <%- include('contracts/imposters', { indent }) -%>
36
+ <%- include('contracts/imposter', { indent }) -%>
37
+ <%- include('contracts/addStub', { indent }) -%>
38
+ <%- include('contracts/stub', { indent }) -%>
39
+ <%- include('contracts/stubs', { indent }) -%>
40
+ <%- include('contracts/config', { indent }) -%>
41
+ <%- include('contracts/logs', { indent }) -%>
42
+ </div>
43
+
44
+ <div class='contract' id='specification-description'>
45
+ <%- include('contracts/home-description', { indent }) -%>
46
+ <%- include('contracts/imposters-description', { indent }) -%>
47
+ <%- include('contracts/imposter-description', { indent }) -%>
48
+ <%- include('contracts/addStub-description', { indent }) -%>
49
+ <%- include('contracts/stub-description', { indent }) -%>
50
+ <%- include('contracts/stubs-description', { indent }) -%>
51
+ <%- include('contracts/config-description', { indent }) -%>
52
+ <%- include('contracts/logs-description', { indent }) -%>
53
+ </div>
54
+
55
+
56
+ <script type='text/javascript'>
57
+ $(document).ready(function () {
58
+ function descriptionFor (id) {
59
+ return $('#' + id + '-description');
60
+ }
61
+
62
+ function movedRight (fromElement, x, y) {
63
+ return x > fromElement.offset().left &&
64
+ y > fromElement.offset().top &&
65
+ y < fromElement.offset().top + fromElement.height();
66
+ }
67
+
68
+ function hoverOn () {
69
+ $('#specification span').on('mouseenter', function () {
70
+ $('#specification span').css('background-color', '');
71
+ $('#specification-description div').hide();
72
+
73
+ var firstSpan = $(this).parent().find(':first-child');
74
+ descriptionFor(this.id).css('top', $(this).offset().top - firstSpan.offset().top);
75
+
76
+ $(this).find('a').css('visibility', 'visible');
77
+ $(this).css('background-color', 'gold');
78
+ descriptionFor(this.id).show();
79
+ });
80
+
81
+ $('#specification span').on('mouseleave', function (event) {
82
+ $(this).find('a').css('visibility', 'hidden');
83
+
84
+ if (!movedRight($(event.fromElement), event.pageX, event.pageY)) {
85
+ $(this).css('background-color', '');
86
+ descriptionFor(this.id).hide();
87
+ }
88
+ });
89
+ }
90
+
91
+ function hoverOff () {
92
+ $('#specification span').off('mouseenter');
93
+ $('#specification span').off('mouseleave');
94
+ }
95
+
96
+ $('#specification a').click(function () {
97
+ if (!this.pinned) {
98
+ this.pinned = true;
99
+ $(this).css('text-decoration', 'underline');
100
+ hoverOff();
101
+ }
102
+ else {
103
+ this.pinned = false;
104
+ $(this).css('text-decoration', '');
105
+ hoverOn();
106
+ }
107
+ });
108
+
109
+ function contractType () {
110
+ var query = location.search.substring(1).split('&');
111
+ for (let i = 0; i < query.length; i++) {
112
+ var key = query[i].split('=')[0],
113
+ value = query[i].split('=')[1];
114
+ if (key === 'type') {
115
+ return value;
116
+ }
117
+ }
118
+ return 'imposter';
119
+ }
120
+
121
+ $('#contract-types').change(function () {
122
+ var id = $(this).val() + '-specification';
123
+ $('#specification pre').hide();
124
+ $('#' + id).show();
125
+ $('#specification-description').height($('#' + id).height());
126
+ });
127
+
128
+ hoverOn();
129
+ $('#contract-types').val(contractType()).change();
130
+ });
131
+ </script>
132
+
133
+ <%- include('../../_footer') -%>
@@ -0,0 +1,64 @@
1
+ <%
2
+ title = 'errors'
3
+ description = 'Information about standard errors returned by mountebank'
4
+ %>
5
+
6
+ <%- include('../../_header') -%>
7
+
8
+ <h1>Errors</h1>
9
+
10
+ <p>mountebank is sorry you are running into errors. To help you diagnose
11
+ the problem, he has listed the API error codes below. Feel free to
12
+ <a href='/support'>ask for help</a> if you get stuck.</p>
13
+
14
+ <table>
15
+ <tr>
16
+ <th>Error code</th>
17
+ <th>Description</th>
18
+ </tr>
19
+ <tr>
20
+ <td><code>bad data</code></td>
21
+ <td>A general validation error. Something in the input is invalid.</td>
22
+ </tr>
23
+ <tr>
24
+ <td><code>invalid injection</code></td>
25
+ <td>You are using the <code>inject</code> operator, either as a predicate
26
+ or response type. Perhaps you have not run <code>mb</code> with the
27
+ <code>--allowInjection</code> flag, or perhaps there is an error in the
28
+ JavaScript you are injecting. Consider using the node.js
29
+ <code>console</code> or mountebank <code>logger</code> objects to help
30
+ debug the problem.</td>
31
+ </tr>
32
+ <tr>
33
+ <td><code>resource conflict</code></td>
34
+ <td>You have specified a port already in use by another application.
35
+ Try killing the other application, or use a different port for the
36
+ imposter.</td>
37
+ </tr>
38
+ <tr>
39
+ <td><code>insufficient access</code></td>
40
+ <td>You have requested an imposter port that the user running
41
+ <code>mb</code> is not authorized to provide. Either request a
42
+ different port, or run <code>mb</code> as <code>sudo</code>.</td>
43
+ </tr>
44
+ <tr>
45
+ <td><code>invalid proxy</code></td>
46
+ <td>You have configured a proxy response type with an invalid address,
47
+ or the server has refused the connection. Double check the DNS name or
48
+ IP address, and double check the port. If <code>mb</code> is running
49
+ on a different network than you are, does he have the same connectivity
50
+ to the proxy that you do?</td>
51
+ </tr>
52
+ <tr>
53
+ <td><code>no such resource</code></td>
54
+ <td>A 404 error code. Probably, you are attempting to access an
55
+ imposter that has not been created yet. Try POSTing to /imposters
56
+ first?</td>
57
+ </tr>
58
+ <tr>
59
+ <td><code>invalid JSON</code></td>
60
+ <td>You have sent a request body, but mountebank is unable to parse it.</td>
61
+ </tr>
62
+ </table>
63
+
64
+ <%- include('../../_footer') -%>
@@ -0,0 +1,31 @@
1
+ <testScenario name='tcp and example'>
2
+ <step type='http'>
3
+ <pre><code>POST /imposters HTTP/1.1
4
+ Host: localhost:<%= port %>
5
+ Accept: application/json
6
+ Content-Type: application/json
7
+
8
+ {
9
+ "port": 4554,
10
+ "protocol": "tcp",
11
+ "mode": "text",
12
+ "stubs": [<strong class='highlight1'>
13
+ {
14
+ "responses": [
15
+ {
16
+ "fault": "CONNECTION_RESET_BY_PEER"
17
+ }
18
+ ]
19
+ }</strong>
20
+ ]
21
+ }</code></pre>
22
+ </step>
23
+
24
+ </step>
25
+
26
+ <step type='http'>
27
+ <code class='hidden'>DELETE /imposters/4554 HTTP/1.1
28
+ Host: localhost:<%= port %>
29
+ Accept: application/json</code>
30
+ </step>
31
+ </testScenario>
@@ -0,0 +1,31 @@
1
+ <testScenario name='tcp and example'>
2
+ <step type='http'>
3
+ <pre><code>POST /imposters HTTP/1.1
4
+ Host: localhost:<%= port %>
5
+ Accept: application/json
6
+ Content-Type: application/json
7
+
8
+ {
9
+ "port": 4554,
10
+ "protocol": "tcp",
11
+ "mode": "text",
12
+ "stubs": [<strong class='highlight1'>
13
+ {
14
+ "responses": [
15
+ {
16
+ "fault": "RANDOM_DATA_THEN_CLOSE"
17
+ }
18
+ ]
19
+ }</strong>
20
+ ]
21
+ }</code></pre>
22
+ </step>
23
+
24
+ </step>
25
+
26
+ <step type='http'>
27
+ <code class='hidden'>DELETE /imposters/4554 HTTP/1.1
28
+ Host: localhost:<%= port %>
29
+ Accept: application/json</code>
30
+ </step>
31
+ </testScenario>
@@ -0,0 +1,57 @@
1
+ <%
2
+ title = 'fault simulation'
3
+ description = 'Using mountebank to simulate network faults'
4
+ %>
5
+
6
+ <%- include('../../_header') -%>
7
+
8
+ <h1>Fault Simulation</h1>
9
+
10
+ <p>Fault simulation allows us to check how our application behaves when downstream dependencies don't respond as expected due to network failures.
11
+ Mountebank already has the ability to specify delays via "wait" but we may also want to test when the connection is abruptly reset or garbage data is returned, similar to some of Wiremock's <a href='http://wiremock.org/docs/simulating-faults/'>fault simulation functionality</a>
12
+ </p>
13
+
14
+ <p>Fault simulation has only been implemented for http, https and tcp protocols.
15
+ The "fault" response type is mutually exclusive with respect to the other response types as it necessarily prevents any normal response being returned to the client.</p>
16
+
17
+ <p>The <code>fault</code> response type takes a single parameter specifying which fault to simulate.</p>
18
+
19
+ <table>
20
+ <tr>
21
+ <th>Parameter</th>
22
+ <th>Description</th>
23
+ </tr>
24
+ <tr>
25
+ <td><code>CONNECTION_RESET_BY_PEER</code></td>
26
+ <td>Close the connection.</td>
27
+ </tr>
28
+ <tr>
29
+ <td><code>RANDOM_DATA_THEN_CLOSE</code></td>
30
+ <td>Send garbage then close the connection.</td>
31
+ </tr>
32
+ </table>
33
+
34
+ <p>Select the behavior of the fault below for a relevant example:</p>
35
+
36
+ <section class='accordion'>
37
+ <div>
38
+ <a class='section-toggler'
39
+ id='connection-reset' name='connection-reset' href='#connection-reset'>
40
+ Connection Reset by Peer
41
+ </a>
42
+ <section>
43
+ <%- include('fault/connectionReset') -%>
44
+ </section>
45
+ </div>
46
+ <div>
47
+ <a class='section-toggler'
48
+ id='random-data-then-close' name='random-data-then-close' href='#random-data-then-close'>
49
+ Random Data then Close
50
+ </a>
51
+ <section>
52
+ <%- include('fault/randomDataThenClose') -%>
53
+ </section>
54
+ </div>
55
+ </section>
56
+
57
+ <%- include('../../_footer') -%>