Rest assured : Bypassing SSL certificate

While working with API testing, we encounter SSL certificate error in testing environment.
It results into below error while executing automation script. PKIX path validation failed: signature check failed

Here is a way to bypass checking for SSL certificate while Rest assured call.
Rest assured has inbuilt option and we do not have to write any other java code to do the same.

Example 1:
RestAssured.baseURI = “”;

//ByPass SSL Certificate

RequestSpecification httpRequest = RestAssured.given();

httpRequest.request(Method.GET, “/resource”);

Example 2:
given(). useRelaxedHTTPSValidation().when().get( “ resource ” );

Example 3:
We can also pass TLS with the same approach.
given(). useRelaxedHTTPSValidation(“TLS”).when().get( “ resource ” );

Leave a Reply