This error occurs when the server breaks the connection to the client. You can decide to repeat the request or simply issue an error so that the user can find out about it and process it.
Because, as the rest-client handles broken connections, as shown here , all you can do is save from it
begin response = RestClient::Request.execute(method: :post, url: url, headers: headers, "Content-Type" => "application/x-www-form-urlencoded") rescue RestClient::ServerBrokeConnection // retry or do something end
rafb3 source share