I’m using @ton/ton
js client to read data from TON blockchain using testnet endpoints from Ton center. I’m constructing the client like this:
const client = new TonClient({
endpoint: "https://testnet.toncenter.com/api/v2/jsonRPC",
});
Every time I try to get data from the blockchain I get a weird error AxiosError: Request failed with status code 400
with code ERR_BAD_REQUEST
, logging the following reason:
'<html>rn' +
'<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>rn' +
'<body>rn' +
'<center><h1>400 Bad Request</h1></center>rn' +
'<center>The plain HTTP request was sent to HTTPS port</center>rn' +
'<hr><center>cloudflare</center>rn' +
'</body>rn' +
'</html>rn'
I have checked the error log and the endpoint is correct and is not http! The weird thing is that when I call the endpoint, using Postman, with the data provided in the error log, I get no error and the request is successful. Anybody experiencing the same problem?