The following code never returns and TLS connection fails. I've also tried raw connection and it just works as intended. I couldn't find a field for declaring certificates for the operation but I think it uses the system's certificates for that
const socket = Bun.connect({
hostname: "example.com",
tls: true,
port: 443,
socket: {
open(socket) {
socket.write("GET / HTTP/1.1\r\nHost: example.com\r\n\r\n");
},
data(socket, data) {
console.log(`got ${data}`);
socket.end();
}
},
});