mockserver-client
Advanced tools
Comparing version 5.3.0 to 5.4.1
@@ -9,4 +9,4 @@ { | ||
"dependencies": { | ||
"mockserver-client": "5.3.0" | ||
"mockserver-client": "5.4.1" | ||
} | ||
} |
@@ -9,4 +9,4 @@ { | ||
"dependencies": { | ||
"mockserver-client": "5.3.0" | ||
"mockserver-client": "5.4.1" | ||
} | ||
} |
@@ -9,4 +9,4 @@ { | ||
"dependencies": { | ||
"mockserver-client": "5.3.0" | ||
"mockserver-client": "5.4.1" | ||
} | ||
} |
@@ -9,4 +9,4 @@ { | ||
"dependencies": { | ||
"mockserver-client": "5.3.0" | ||
"mockserver-client": "5.4.1" | ||
} | ||
} |
@@ -9,4 +9,4 @@ { | ||
"dependencies": { | ||
"mockserver-client": "5.3.0" | ||
"mockserver-client": "5.4.1" | ||
} | ||
} |
@@ -9,4 +9,4 @@ { | ||
"dependencies": { | ||
"mockserver-client": "5.3.0" | ||
"mockserver-client": "5.4.1" | ||
} | ||
} |
@@ -9,4 +9,4 @@ { | ||
"dependencies": { | ||
"mockserver-client": "5.3.0" | ||
"mockserver-client": "5.4.1" | ||
} | ||
} |
@@ -9,4 +9,4 @@ { | ||
"dependencies": { | ||
"mockserver-client": "5.3.0" | ||
"mockserver-client": "5.4.1" | ||
} | ||
} |
@@ -9,4 +9,4 @@ { | ||
"dependencies": { | ||
"mockserver-client": "5.3.0" | ||
"mockserver-client": "5.4.1" | ||
} | ||
} |
@@ -9,4 +9,4 @@ { | ||
"dependencies": { | ||
"mockserver-client": "5.3.0" | ||
"mockserver-client": "5.4.1" | ||
} | ||
} |
@@ -9,5 +9,5 @@ { | ||
"dependencies": { | ||
"mockserver-client": "5.3.0", | ||
"mockserver-node": "5.3.0" | ||
"mockserver-client": "5.4.1", | ||
"mockserver-node": "5.4.1" | ||
} | ||
} |
@@ -9,5 +9,5 @@ { | ||
"dependencies": { | ||
"mockserver-client": "5.3.0", | ||
"mockserver-node": "5.3.0" | ||
"mockserver-client": "5.4.1", | ||
"mockserver-node": "5.4.1" | ||
} | ||
} |
@@ -32,3 +32,3 @@ /* | ||
serverPort: 1080, | ||
proxyPort: 1090, | ||
trace: true, | ||
systemProperties: "-Dmockserver.enableCORSForAllResponses=true" | ||
@@ -39,4 +39,3 @@ } | ||
options: { | ||
serverPort: 1080, | ||
proxyPort: 1090 | ||
serverPort: 1080 | ||
} | ||
@@ -55,16 +54,2 @@ }, | ||
}, | ||
webdriver_jasmine_runner: { | ||
with_proxy: { | ||
options: { | ||
browser: 'chrome', | ||
testServer: 'localhost', | ||
testServerPort: 1080, | ||
testFile: 'test/SpecRunner.html?proxy=true', | ||
proxy: { | ||
proxyType: 'manual', | ||
httpProxy: 'localhost:1090' | ||
} | ||
} | ||
} | ||
}, | ||
karma: { | ||
@@ -80,30 +65,7 @@ options: { | ||
'mockServerClient.js', | ||
'proxyClient.js', | ||
'test/no_proxy/mock_server_browser_client_spec.js', | ||
'test/with_proxy/proxy_browser_client_spec.js' | ||
'test/no_proxy/mock_server_browser_client_spec.js' | ||
] | ||
}, | ||
no_proxy_phantom: { | ||
browsers: ['PhantomJS'], | ||
mode: 'no_proxy' | ||
}, | ||
with_proxy_phantom: { | ||
browsers: ['PhantomJS_with_proxy'], | ||
mode: 'with_proxy' | ||
}, | ||
no_proxy_chrome: { | ||
browsers: ['Chrome'], | ||
mode: 'no_proxy' | ||
}, | ||
with_proxy_chrome: { | ||
browsers: ['Chrome_with_proxy'], | ||
// browsers: ['Chrome'], | ||
mode: 'with_proxy', | ||
proxies: { | ||
'/somePath': 'http://127.0.0.1:1090/somePath', | ||
'/someOtherPath': 'http://127.0.0.1:1090/someOtherPath', | ||
'/one': 'http://127.0.0.1:1090/one', | ||
'/two': 'http://127.0.0.1:1090/two', | ||
'/three': 'http://127.0.0.1:1090/three' | ||
} | ||
chrome: { | ||
browsers: ['Chrome'] | ||
} | ||
@@ -119,9 +81,8 @@ } | ||
grunt.loadNpmTasks('grunt-karma'); | ||
grunt.loadNpmTasks('grunt-webdriver-jasmine-runner'); | ||
grunt.registerTask('test_node', ['start_mockserver', 'nodeunit', 'stop_mockserver']); | ||
grunt.registerTask('test_browser', ['start_mockserver', 'karma:no_proxy_chrome', 'karma:with_proxy_chrome', 'stop_mockserver']); | ||
grunt.registerTask('test', ['start_mockserver', 'nodeunit', 'karma:no_proxy_chrome'/*, 'karma:with_proxy_chrome'*/, 'stop_mockserver']); | ||
grunt.registerTask('test_browser', ['start_mockserver', 'karma:chrome', 'stop_mockserver']); | ||
grunt.registerTask('test', ['start_mockserver', 'nodeunit', 'karma:chrome', 'stop_mockserver']); | ||
grunt.registerTask('default', ['exec:stop_existing_mockservers', 'jshint', 'test']); | ||
grunt.registerTask('default', ['exec:stop_existing_mockservers', 'jshint', 'test_node']); | ||
}; |
@@ -13,5 +13,4 @@ /* | ||
module.exports = { | ||
mockServerClient: require('./mockServerClient').mockServerClient, | ||
proxyClient: require('./proxyClient').proxyClient | ||
mockServerClient: require('./mockServerClient').mockServerClient | ||
}; | ||
})(); |
@@ -48,3 +48,3 @@ /* | ||
/** | ||
* Start the client communicating to a MockServer at the specified host and port | ||
* Start the client communicating at the specified host and port | ||
* for example: | ||
@@ -54,5 +54,5 @@ * | ||
* | ||
* @param host the host for the MockServer to communicate with | ||
* @param port the port for the MockServer to communicate with | ||
* @param contextPath the context path if MockServer was deployed as a war | ||
* @param host the host for the server to communicate with | ||
* @param port the port for the server to communicate with | ||
* @param contextPath the context path if server was deployed as a war | ||
*/ | ||
@@ -147,3 +147,3 @@ mockServerClient = function (host, port, contextPath) { | ||
httpRequest: requestMatcher, | ||
httpObjectCallback: { | ||
httpResponseObjectCallback: { | ||
clientId: clientId | ||
@@ -223,6 +223,6 @@ }, | ||
/** | ||
* Setup an expectation in the MockServer by specifying an expectation object | ||
* Setup an expectation by specifying an expectation object | ||
* for example: | ||
* | ||
* mockServerClient("localhost", 1080).mockAnyResponse( | ||
* client.mockAnyResponse( | ||
* { | ||
@@ -257,10 +257,9 @@ * 'httpRequest': { | ||
/** | ||
* Setup an expectation in the MockServer by specifying a request matcher, and | ||
* Setup an expectation by specifying a request matcher, and | ||
* a local request handler function. The request handler function receives each | ||
* request (that matches the request matcher) and returns the response that the | ||
* MockServer will return for this expectation. | ||
* request (that matches the request matcher) and returns the response that will be returned for this expectation. | ||
* | ||
* for example: | ||
* | ||
* mockServerClient("localhost", 1080).mockWithCallback( | ||
* client.mockWithCallback( | ||
* { | ||
@@ -288,2 +287,3 @@ * path: '/somePath', | ||
* @param requestHandler the function to be called back when the request is matched | ||
* @param times the number of times the requestMatcher should be matched | ||
*/ | ||
@@ -296,5 +296,9 @@ var mockWithCallback = function (requestMatcher, requestHandler, times) { | ||
webSocketClient.requestCallback(function (request) { | ||
var response = requestHandler(request); | ||
response.headers = arrayUniqueConcatenate(response.headers, [ | ||
{"name": "WebSocketCorrelationId", "values": request.headers["WebSocketCorrelationId"] || request.headers["websocketcorrelationid"]} | ||
]); | ||
return { | ||
type: "org.mockserver.model.HttpResponse", | ||
value: JSON.stringify(requestHandler(request)) | ||
value: JSON.stringify(response) | ||
}; | ||
@@ -312,6 +316,6 @@ }); | ||
/** | ||
* Setup an expectation in the MockServer without having to specify the full expectation object | ||
* Setup an expectation without having to specify the full expectation object | ||
* for example: | ||
* | ||
* mockServerClient("localhost", 1080).mockSimpleResponse('/somePath', { name: 'value' }, 203); | ||
* client.mockSimpleResponse('/somePath', { name: 'value' }, 203); | ||
* | ||
@@ -335,3 +339,3 @@ * @param path the path to match requests against | ||
* | ||
* mockServerClient("localhost", 1080).setDefaultHeaders([ | ||
* client.setDefaultHeaders([ | ||
* {"name": "Content-Type", "values": ["application/json; charset=utf-8"]}, | ||
@@ -355,2 +359,3 @@ * {"name": "Cache-Control", "values": ["no-cache, no-store"]} | ||
}; | ||
var addDefaultRequestMatcherHeaders = function (pathOrRequestMatcher) { | ||
@@ -493,3 +498,3 @@ var requestMatcher; | ||
/** | ||
* Reset MockServer by clearing all expectations | ||
* Reset by clearing all recorded requests | ||
*/ | ||
@@ -503,3 +508,3 @@ var reset = function () { | ||
* @param pathOrRequestMatcher if a string is passed in the value will be treated as the path to | ||
* decide which expectations to cleared, however if an object is passed | ||
* decide what to clear, however if an object is passed | ||
* in the value will be treated as a full request matcher object | ||
@@ -517,4 +522,14 @@ * @param type the type to clear 'EXPECTATIONS', 'LOG' or 'ALL', defaults to 'ALL' if not specified | ||
}; | ||
/** | ||
* Add new ports the server is bound to and listening on | ||
* | ||
* @param ports array of ports to bind to, use 0 to bind to any free port | ||
*/ | ||
var bind = function (ports) { | ||
if (!Array.isArray(ports)) { | ||
throw new Error("ports parameter must be an array but found: " + JSON.stringify(ports)); | ||
} | ||
return makeRequest(host, port, "/bind", {ports: ports}); | ||
}; | ||
/** | ||
* Retrieve the recorded requests that match the parameter, as follows: | ||
@@ -599,3 +614,3 @@ * - use a string value to match on path, | ||
.then(function (result) { | ||
sucess(result.body && result.body.split("------------------------------------")); | ||
sucess(result.body && result.body.split("------------------------------------")); | ||
}); | ||
@@ -615,2 +630,3 @@ } | ||
clear: clear, | ||
bind: bind, | ||
retrieveRecordedRequests: retrieveRecordedRequests, | ||
@@ -617,0 +633,0 @@ retrieveActiveExpectations: retrieveActiveExpectations, |
{ | ||
"name": "mockserver-client", | ||
"description": "A node client for the MockServer", | ||
"version": "5.3.0", | ||
"version": "5.4.1", | ||
"homepage": "https://github.com/jamesdbloom/mockserver", | ||
@@ -23,21 +23,19 @@ "author": { | ||
"devDependencies": { | ||
"grunt": ">=0.4", | ||
"grunt-contrib-clean": "~1.1", | ||
"grunt-contrib-jshint": "~1.1", | ||
"grunt-contrib-nodeunit": "~1.0", | ||
"grunt": "^1.0.3", | ||
"grunt-contrib-clean": "~2.0", | ||
"grunt-contrib-jshint": "~2.0", | ||
"grunt-contrib-nodeunit": "~2.0", | ||
"grunt-exec": "~3.0", | ||
"grunt-jasmine-runner": "~0.6", | ||
"grunt-karma": "~2.0", | ||
"grunt-webdriver-jasmine-runner": "~0.3", | ||
"jasmine-core": "~2.8", | ||
"karma": "~1.3", | ||
"grunt-karma": "~3.0", | ||
"jasmine-core": "~3.3", | ||
"karma": "~3.1", | ||
"karma-chrome-launcher": "~2.2", | ||
"karma-firefox-launcher": "~1.0", | ||
"karma-jasmine": "~1.1", | ||
"karma-phantomjs-launcher": "~1.0", | ||
"karma-firefox-launcher": "~1.1", | ||
"karma-jasmine": "^1.1.2", | ||
"karma-safari-launcher": "~1.0", | ||
"karma-spec-reporter": "~0.0", | ||
"karma-spec-reporter": "0.0.32", | ||
"karma-xvfb-chrome-launcher": "0.0.1", | ||
"mockserver-node": "5.3.0", | ||
"nodeunit": "~0.11" | ||
"mockserver-node": "5.4.1", | ||
"nodeunit": "^0.11.3" | ||
}, | ||
@@ -51,4 +49,4 @@ "keywords": [ | ||
"q": "~2.0", | ||
"websocket": "~1.0" | ||
"websocket": "^1.0.28" | ||
} | ||
} |
@@ -19,8 +19,7 @@ # mockserver-client-node | ||
The both the MockServer and proxy clients can be created as follows: | ||
The the MockServer client can be created as follows: | ||
```js | ||
var mockServer = require('mockserver-client'), | ||
mockServerClient = mockServer.mockServerClient, // MockServer client | ||
proxyClient = mockServer.proxyClient; // proxy client | ||
mockServerClient = mockServer.mockServerClient // MockServer and proxy client | ||
``` | ||
@@ -180,2 +179,3 @@ **Note:** this assumes you have an instance of MockServer running on port 1080 for more information on how to do this see [mockserver-grunt](https://www.npmjs.org/package/mockserver-grunt). | ||
2017-12-25 | v5.3.0 | Upgrading MockServer to 5.3.0 | ||
2018-11-04 | v5.4.1 | Upgrading MockServer to 5.4.1 | ||
@@ -182,0 +182,0 @@ --- |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
685627
17
13322
53
Updatedwebsocket@^1.0.28