|
37 | 37 | </div>
|
38 | 38 | <button class="accordion inner">REST API</button>
|
39 | 39 | <div class="panel">
|
40 |
| - <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/expectation" -d '{ |
| 40 | + <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/mockserver/expectation" -d '{ |
41 | 41 | "httpRequest": {
|
42 | 42 | "path": "/some/path"
|
43 | 43 | },
|
|
88 | 88 | </div>
|
89 | 89 | <button class="accordion inner">REST API</button>
|
90 | 90 | <div class="panel">
|
91 |
| - <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/expectation" -d '{ |
| 91 | + <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/mockserver/expectation" -d '{ |
92 | 92 | "httpRequest": {
|
93 | 93 | "path": "/some/path"
|
94 | 94 | },
|
|
100 | 100 | }'</code></pre>
|
101 | 101 | </div>
|
102 | 102 | </div>
|
| 103 | +<button id="button_forward_overridden" class="accordion">forward overridden request</button> |
| 104 | +<div class="panel"> |
| 105 | + <button class="accordion inner">Java</button> |
| 106 | + <div class="panel"> |
| 107 | + <pre class="prettyprint lang-java code"><code class="code">new MockServerClient("localhost", 1080) |
| 108 | + .when( |
| 109 | + request() |
| 110 | + .withPath("/some/path") |
| 111 | + ) |
| 112 | + .forward( |
| 113 | + forwardOverriddenRequest( |
| 114 | + request() |
| 115 | + .withPath("/some/other/path") |
| 116 | + .withHeader("Host", "target.host.com") |
| 117 | + ) |
| 118 | + );</code></pre> |
| 119 | + </div> |
| 120 | + <button class="accordion inner">JavaScript</button> |
| 121 | + <div class="panel"> |
| 122 | + <pre class="prettyprint lang-javascript code"><code class="code">var mockServerClient = require('mockserver-client').mockServerClient; |
| 123 | +mockServerClient("localhost", 1080).mockAnyResponse({ |
| 124 | + "httpRequest": { |
| 125 | + "path": "/some/path" |
| 126 | + }, |
| 127 | + "httpOverrideForwardedRequest": { |
| 128 | + "httpRequest": { |
| 129 | + "path": "/some/other/path", |
| 130 | + "headers": { |
| 131 | + "Host": ["target.host.com"] |
| 132 | + } |
| 133 | + } |
| 134 | + } |
| 135 | +}).then( |
| 136 | + function () { |
| 137 | + console.log("expectation created"); |
| 138 | + }, |
| 139 | + function (error) { |
| 140 | + console.log(error); |
| 141 | + } |
| 142 | +);</code></pre> |
| 143 | + </div> |
| 144 | + <button class="accordion inner">REST API</button> |
| 145 | + <div class="panel"> |
| 146 | + <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/mockserver/expectation" -d '{ |
| 147 | + "httpRequest": { |
| 148 | + "path": "/some/path" |
| 149 | + }, |
| 150 | + "httpOverrideForwardedRequest": { |
| 151 | + "httpRequest": { |
| 152 | + "path": "/some/other/path", |
| 153 | + "headers": { |
| 154 | + "Host": ["target.host.com"] |
| 155 | + } |
| 156 | + } |
| 157 | + } |
| 158 | +}'</code></pre> |
| 159 | + </div> |
| 160 | +</div> |
| 161 | +<button id="button_forward_overridden_with_delay" class="accordion">forward overridden request with delay</button> |
| 162 | +<div class="panel"> |
| 163 | + <button class="accordion inner">Java</button> |
| 164 | + <div class="panel"> |
| 165 | + <pre class="prettyprint lang-java code"><code class="code">new MockServerClient("localhost", 1080) |
| 166 | + .when( |
| 167 | + request() |
| 168 | + .withPath("/some/path") |
| 169 | + ) |
| 170 | + .forward( |
| 171 | + forwardOverriddenRequest( |
| 172 | + request() |
| 173 | + .withHeader("Host", "target.host.com") |
| 174 | + .withBody("some_overridden_body") |
| 175 | + ).withDelay(SECONDS, 10) |
| 176 | + );</code></pre> |
| 177 | + </div> |
| 178 | + <button class="accordion inner">JavaScript</button> |
| 179 | + <div class="panel"> |
| 180 | + <pre class="prettyprint lang-javascript code"><code class="code">var mockServerClient = require('mockserver-client').mockServerClient; |
| 181 | +mockServerClient("localhost", 1080).mockAnyResponse({ |
| 182 | + "httpRequest": { |
| 183 | + "path": "/some/path" |
| 184 | + }, |
| 185 | + "httpOverrideForwardedRequest": { |
| 186 | + "httpRequest": { |
| 187 | + "path": "/some/other/path", |
| 188 | + "body": "some_overridden_body", |
| 189 | + "headers": { |
| 190 | + "Host": ["target.host.com"] |
| 191 | + } |
| 192 | + }, |
| 193 | + "delay": { |
| 194 | + "timeUnit": "SECONDS", |
| 195 | + "value": 10 |
| 196 | + } |
| 197 | + } |
| 198 | +}).then( |
| 199 | + function () { |
| 200 | + console.log("expectation created"); |
| 201 | + }, |
| 202 | + function (error) { |
| 203 | + console.log(error); |
| 204 | + } |
| 205 | +);</code></pre> |
| 206 | + </div> |
| 207 | + <button class="accordion inner">REST API</button> |
| 208 | + <div class="panel"> |
| 209 | + <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/mockserver/expectation" -d '{ |
| 210 | + "httpRequest": { |
| 211 | + "path": "/some/path" |
| 212 | + }, |
| 213 | + "httpOverrideForwardedRequest": { |
| 214 | + "httpRequest": { |
| 215 | + "path": "/some/other/path", |
| 216 | + "body": "some_overridden_body", |
| 217 | + "headers": { |
| 218 | + "Host": ["target.host.com"] |
| 219 | + } |
| 220 | + }, |
| 221 | + "delay": { |
| 222 | + "timeUnit": "SECONDS", |
| 223 | + "value": 10 |
| 224 | + } |
| 225 | + } |
| 226 | +}'</code></pre> |
| 227 | + </div> |
| 228 | +</div> |
103 | 229 | <button id="button_javascript_templated_forward" class="accordion">javascript templated forward</button>
|
104 | 230 | <div class="panel">
|
105 | 231 | <button class="accordion inner">Java</button>
|
|
160 | 286 | </div>
|
161 | 287 | <button class="accordion inner">REST API</button>
|
162 | 288 | <div class="panel">
|
163 |
| - <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/expectation" -d '{ |
| 289 | + <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/mockserver/expectation" -d '{ |
164 | 290 | "httpRequest": {
|
165 | 291 | "path": "/some/path"
|
166 | 292 | },
|
|
244 | 370 | </div>
|
245 | 371 | <button class="accordion inner">REST API</button>
|
246 | 372 | <div class="panel">
|
247 |
| - <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/expectation" -d '{ |
| 373 | + <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/mockserver/expectation" -d '{ |
248 | 374 | "httpRequest": {
|
249 | 375 | "path": "/some/path"
|
250 | 376 | },
|
|
333 | 459 | </div>
|
334 | 460 | <button class="accordion inner">REST API</button>
|
335 | 461 | <div class="panel">
|
336 |
| - <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/expectation" -d '{ |
| 462 | + <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/mockserver/expectation" -d '{ |
337 | 463 | "httpRequest": {
|
338 | 464 | "path": "/some/path"
|
339 | 465 | },
|
|
413 | 539 | </div>
|
414 | 540 | <button class="accordion inner">REST API</button>
|
415 | 541 | <div class="panel">
|
416 |
| - <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/expectation" -d '{ |
| 542 | + <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/mockserver/expectation" -d '{ |
417 | 543 | "httpRequest" : {
|
418 | 544 | "path" : "/some.*"
|
419 | 545 | },
|
|
0 commit comments