Closed calbertts closed 4 years ago
It turns out to be an issue with the client library only, with the latest docker image version works fine until mockserver-client@5.7.0
The issue starts from mockserver-client@5.7.1
I believe this is fixed in the latest version 5.11.0, I used the following code:
function createExpectation() {
var mockServerClient = require('mockserver-client').mockServerClient;
mockServerClient("localhost", 1080)
.mockAnyResponse({
"httpRequest": {
"method": "GET",
"path": "/view/cart",
"queryStringParameters": {
"cartId": ["055CA455-1DF7-45BB-8535-4F83E7266092"]
},
"cookies": {
"session": "4930456C-C718-476F-971F-CB8E047AB349"
}
},
"httpResponse": {
"body": "some_response_body"
}
})
.then(
function () {
console.log("expectation created");
},
function (error) {
console.log(error);
}
);
}
createExpectation();
and got the following output:
Saved CertificateAuthorityCertificate.pem from {
"protocol": "https:",
"method": "GET",
"host": "raw.githubusercontent.com",
"path": "/mock-server/mockserver/master/mockserver-core/src/main/resources/org/mockserver/socket/CertificateAuthorityCertificate.pem",
"port": 443
}
expectation created
Please try the latest version, I'm going to close this issue but if it is not fixed please comment here or create a new issue.
Hi @jamesdbloom. Yesterday I wanted to update our mock-server setup to the latest version. We're using a mock-server docker installation and the mock-server-client-node for creating expectations. So we switched to 5.11.2 but unfortunately I faced the very same issue that was mentioned by @calbertts. Everything works fine with the mock-server-client up to 5.7.0, but all later versions result in the mentioned issue. In our setup we're not using any TLS/HTTPS communication at all. Do you have any idea, what could be the reason for that? What I've also noticed is, that communication via REST-API (curl) works fine as well.
Describe the issue I've been using mock-server successfully several months ago, but today, trying to upgrade to the latest version, I'm unable to load expectations.
What you are trying to do Load expectations with a NodeJS script.
MockServer version 5.6.1 -> Works! 5.9.0 -> Doesn't work
To Reproduce Run a mock-server in the 443 port with
-serverPort
docker run \ -u 0 \ --memory=1GB \ -d \ --name $CONTAINER_NAME \ -p $HOST_PORT:$CONTAINER_PORT \ $DOCKER_IMAGE -serverPort $CONTAINER_PORT
Fetching { "protocol": "https:", "method": "GET", "host": "raw.githubusercontent.com", "path": "/mock-server/mockserver/master/mockserver-core/src/main/resources/org/mockserver/socket/CertificateAuthorityCertificate.pem", "port": 443 } failed with error Error: connect ETIMEDOUT 151.101.132.133:443