Disable SSL Certificate Validation in Ballerina HTTP Client

53 Views Asked by At

I need to call an endpoint with a self-signed certificate using the Ballerina HTTP client.

import ballerina/http;

http:Client httpClient = check new("<URL>");

Is there a way to disable SSL certificate validation in Ballerina?

1

There are 1 best solutions below

0
On BEST ANSWER

Disabling SSL certificate validation in the Ballerina http:Client can be achieved by configuring the secureSocket option in the client configuration.

import ballerina/http;

http:Client httpClient = check new("<URL>", {secureSocket: {enable: false}});

Reference: Client SecureSocket Configuration