Not able to create a get request using mountebank

86 views
Skip to first unread message

Keshav chander

unread,
Jan 3, 2023, 12:44:37 AM1/3/23
to mountebank-discuss
Hey hi Mount bankers,
I am new to this technology ,i am creating a get request using mountebank my requirement is when ever i hit that api it should send me a respose as i need but getting an error as : "requests.exceptions.SSLError: HTTPSConnectionPool(host='localhost', port=4545): Max retries exceeded with url: /reqres.in/api/users/2 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:997)')))"

my json body is:

json_data = {
"port": 4545,
"protocol": "https",
"recordRequests": True,
"stubs": [
{
"predicates": [
{
"equals": {
"method": "GET",
"path": "/api/users/2"
}
}
],
"responses": [
{
"is": {
"statusCode": 201,
"headers": {
"Location": "https://localhost:4545/reqres.in/api/users/2",
"Content-Type": "application/json"
},
"body": {
"data": {
"id": 2,
"email": "janet....@reqres.in",
"first_name": "Janet",
"last_name": "Weaver",
"avatar": "https://reqres.in/img/faces/2-image.jpg"
},
"support": {
"url": "https://reqres.in/#support-heading",
"text": "To keep ReqRes free, contributions towards server costs are appreciated!"
}
}
}
},
{
"is": {
"statusCode": 400,
"headers": {
"Content-Type": "application/json"
},
"body": {"status":"error"}

}
}
]
},
{
"responses": [
{
"is": {"statusCode": 404}
}
]
}
]
}

Please let me know how to do this
regards 
Keshav

Bob Ruub

unread,
Jan 17, 2023, 5:23:05 PM1/17/23
to mountebank-discuss
By default mountebank uses a locally signed ssl certificate, http://www.mbtest.org/docs/protocols/https

Solutions are on that page I linked:
  • Test against an http imposter, and trust that the SSL/TLS libraries your system under test is using just work.
  • Create your own self-signed certificate for testing and add it to your local trust store only. Have a look at mkcert for a simple way of doing this.
  • Use a real trusted certificate for testing. If you can't have your organization create one for you, Let's Encrypt offers a free service to create trusted certificates.
You can also have the calling system ignore self signed certificate errors.

Personally, I always go for http only as I'm no network or security expert and setting up SSL is a dark art best performed by wizards :)
Reply all
Reply to author
Forward
0 new messages