amplify icon indicating copy to clipboard operation
amplify copied to clipboard

Sendings an array as JSON using dataMap: JSON.stringify fails

Open jlogar opened this issue 11 years ago • 3 comments

I use the setting dataMap: JSON.stringify to send JSON requests to the server. Everything works fine when I send normal objects. When sending an array amplify.requests creates an object from from the array. Seems to happen here: https://github.com/appendto/amplify/blob/master/src/request.js#L212

In my branch I've added a failing test and a passing test for using stringify directly. jlogar/amplify@a6784fe355127cf60b13f77906d86c15cd1616d1

jlogar avatar Jul 13 '13 18:07 jlogar

@jlogar – I started looking at this, and at your code – but haven't spent too much time with it yet. I was getting some failing tests (In addition to the one that was supposed to fail :D), but haven't dug too deep yet. I just wanted you to know I saw your request and am looking into it.

dcneiner avatar Jul 17 '13 04:07 dcneiner

@jlogar I put together a fix, based off the work in your branch that I tweaked a bit. Please try out this branch and see if it works as you would expect: https://github.com/appendto/amplify/tree/issue-88

dcneiner avatar Aug 16 '13 03:08 dcneiner

@dcneiner Tried it. Seems to work like a charm! Thanks a bunch for the fix! Hope it gets into the master branch soon.

jlogar avatar Aug 16 '13 09:08 jlogar