Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make HTTPS GET call with certificate in Rest-Assured java

Tags:

How can I make a GET call using Rest-Assured in java to a endpoint which requires certificate. I have certificate as .pem format. In PEM file there is certificate and private key.

like image 206
rohitkadam19 Avatar asked Apr 01 '16 08:04

rohitkadam19


People also ask

How do I pass a certificate in HTTPS request?

To obtain an HTTPS certificate, perform the following steps: Create a private and public key pair, and prepare a Certificate Signing Request (CSR), including information about the organization and the public key. Contact a certification authority and request an HTTPS certificate, based on the CSR.

How do you handle certificate issues in Rest assured?

We generally encounter these issues in test environment when trusted certificate is not available (Trusted certificate are always reserved for production). To resolve the issue with SSL certifcate, RestAssured provides implementation in SSLConfig() package.


1 Answers

In my case using "relaxed HTTPs validation" fixed my problem:

given().relaxedHTTPSValidation().when().post("https://my_server.com")
like image 136
Saeed Zarinfam Avatar answered Sep 19 '22 18:09

Saeed Zarinfam