VarunGrazitti
10 years agoBoss
How to evaluate values from request parameters when we hit with formData method
We are facing some issues in interaction of component with endpoint. When we make a call from component to endpoint with {key:value} syntax then we can successfully get these request variables at endpoint, but when we try in Form Data, then we do not get that data on endpoint.
Here is a similar unanswered query
Component Code:
var URL = "${endpoint_url}"; var fd = new FormData(); fd.append('title', "abc"); fd.append('description', "jkl"); var req = { method: 'POST', url: URL, headers: { 'Content-Type': undefined }, data: fd } $http(req). then(function(response) { console.log(response); },
Endpoint Code:
<#assign title = http.request.parameters.name.get("title","") /> // if we evaluate this value it is blank <#assign description = http.request.parameters.name.get("description","") /> // if we evaluate this value it is blank
Also, with the case of attachment upload, if we append a file variable, then how can we get this on endpoint?
Thanks in advance