Open isuruuy429 opened 4 years ago
Description: $subject.
Steps to Reproduce
import wso2/ftp; import ballerina/config; import ballerina/http; import ballerina/log; ftp:ClientEndpointConfig ftpConfig = { protocol: ftp:FTP, host: config:getAsString("ftp.host"), port: config:getAsInt("ftp.port"), secureSocket: { basicAuth: { username: config:getAsString("ftp.username"), password: config:getAsString("ftp.password") } } }; ftp:Client ftp = new(ftpConfig); @http:ServiceConfig { basePath: "company" } resource function retreiveFileSize(http:Caller caller, http:Request request) returns error? { http:Response response = new(); var sizeResponse = ftp->size("/home/ftp-user/in/employees.xml"); if (sizeResponse is int) { response.setJsonPayload("File size: " +sizeResponse.toString()); log:printInfo("File size: " + sizeResponse.toString()); } else { response.setJsonPayload({Message: "Error occured in retrieving size", Reason: sizeResponse.reason()}); log:printError("Error occured in retrieving size", sizeResponse); } var httpResult = caller->respond(response); } }
curl http://localhost:9090/company/retreiveFileSize
It only outputs the size of the file, but not the unit.
Affected Product Version: Ballerina Integrator 7.0.1 Ballerina version: 1.0.2
Description: $subject.
Steps to Reproduce
curl http://localhost:9090/company/retreiveFileSize
It only outputs the size of the file, but not the unit.
Affected Product Version: Ballerina Integrator 7.0.1 Ballerina version: 1.0.2