-
Improvement
-
Resolution: Fixed
-
Major
-
None
-
None
-
None
-
-
Empty show more show less
-
Declarative REST 10, Declarative REST 11
-
3
If a developer changes body of a request on a RestCall in a usage, it should not have an effect on the client itself, or other calls of the rest client - the changes to the body should only affect that specific one call, on that specific client.
(I have not tested, but the problem may apply to other aspects of a request such as headers, parameters)
I have only tested this one example - but I am wondering how this relates to usages in different locations in java code or also in restfn in templates.
// code placeholder //JS model var restClient = restClientFactory.createClient(restClientRegistry.getProvider("posts").get()); var restCall = restClient.getRestClientDefinition().getRestCalls().get("create") restCall.getHeaders().put("Content-Type", "application/json; charset=UTF-8") restCall.setBody({ title: title, body: body}) var result1 = JSON.parse(restClient.invoke(restCall)) // This call will have the body set above! Not good! var restCall2 = restClient.getRestClientDefinition().getRestCalls().get("create") var result2 = JSON.parse(restClient.invoke(restCall2)) // This call will have the body set above! Not good! var restClient3 = restClientFactory.createClient(restClientRegistry.getProvider("posts").get()); var restCall3 = restClient3.getRestClientDefinition().getRestCalls().get("create")var result3 = JSON.parse(restClient3.invoke(restCall3))
Above example adopted from: https://git.magnolia-cms.com/users/jfranco/repos/declarative-rest/browse/declarative-rest-demo/src/main/resources/declarative-rest-demo/templates/components/rest-model.js?at=refs%2Fheads%2Fjorge%2FduplicatePosts
- is causing
-
MGNLRESTCL-102 DOC: Optional body param in restCallName
- Closed
- mentioned in
-
Page Loading...