Closed SupunS closed 6 years ago
Consider the below service:
import ballerina.net.http; @http:configuration {basePath:"/echo"} service<http> echo { @http:resourceConfig { methods:["POST"], path:"/" } resource echo (http:Request req, http:Response res) { json payload = req.getJsonPayload(); res.setStringPayload("hello!"); res.send(); } }
Here at the implementation level, the stream coming from the wire do get built at the point the payload is retrieved as JSON. i.e: req.getJsonPayload();.
req.getJsonPayload();
But ideally since the payload json is never used, it should not get built.
payload
We had several discussions regarding this, and concluded that this is the expected behavior.
Consider the below service:
Here at the implementation level, the stream coming from the wire do get built at the point the payload is retrieved as JSON. i.e:
req.getJsonPayload();
.But ideally since the
payload
json is never used, it should not get built.