I have a javascript object to be sent to server as follow :
var input = {a: 'aaa', b: 'bbb', c: 'ccc'};And I want to send 'a' property in url like this
http://localhost/rest/customer/aaaThat's fine with url substitution feature in amplifyjs as follow :
amplify.request.define('update-customer', 'ajax', { url : 'rest/customer/{a}', dataType: 'json', type : 'PUT' contentType : 'application/json; charset=utf-8; }); amplify.request('update-customer', { a : input.a, info : input });The point I am struggling with is that I would like to send b and c property as a form data in json format as 'Request Payload', however it is failed becauseof the form data is sent as follow :
Request Payload : info : {b : 'bbb', c : 'ccc'}So what I want to achieve is to remove 'info' key in 'Request Payload' as follow :
Request Payload : {b : 'bbb', c : 'ccc'}I tested this in REST Client program and succeeded. This means I need to remove key attribute , 'info' in my case.
To wrap up my question, How to send data attached in Request Body without key name using amplifyjs? Thanks in advance.
amplify.request('update-customer', input );It will match the "a" and remove it, leaving just { b: 'bob', c: 'ccc' } to be sent to the server, without that extra "info" key you had.
Hope that helps!
Doug
--
You received this message because you are subscribed to the Google Groups "Amplify" group.
To unsubscribe from this group and stop receiving emails from it, send an email to amplifyjs+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
The key is already removed from the data object by the time the data map prefilter has a chance to access the data.
--