These are chat archives for canjs/canjs

1st
Sep 2017
Viktor Busko
@Lighttree
Sep 01 2017 10:07
Guys, in what cases this warning appear ? log.js:99 WARN: DefineMap::attr shouldn't be called
Not sure what exactly wrong.
Jeroen Cornelissen
@jeroencornelissen
Sep 01 2017 11:13
@Lighttree We get the same message (a lot). I guess it’s something internal.
Kevin Phillips
@phillipskevin
Sep 01 2017 14:42
@Lighttree or @Lighttree can one of you put a breakpoint here: https://github.com/canjs/can-define/blob/3e77b3bfbd58cf347f51f57f0b331d95e867558c/list/list.js#L1347 and trace it back to where attr is being called?
Nitin Pasumarthy
@Nithanaroy
Sep 01 2017 18:27
We are using can-connect, ^1.3.6. Observed the recent change in model.save() behavior from sending JSON data (to server) to url-encoded format. We are using baseMap() with our models and unable to save due to request data format change. Any ideas on how to change this setting in baseMap?
Runn Vermel
@runn-vermel
Sep 01 2017 18:28
+1^
Kevin Phillips
@phillipskevin
Sep 01 2017 18:31
what version are you on? we'll investigate why this changed
I think you can change this with the content-type header
something like
url: {
  resource: '/my/api',
  contentType: 'application/json'
}
Nitin Pasumarthy
@Nithanaroy
Sep 01 2017 18:35
We are using can-connect, 1.5.7
baseMap({
  "idProp": "id",
  "Map": Report,
  "List": Report.List,
  "url": `/api/v1/report/`,
  "name": "Report",
  "parseListProp": "result",
  "parseInstanceProp": "result"
});
url here?
Kevin Phillips
@phillipskevin
Sep 01 2017 18:37
yes
Nitin Pasumarthy
@Nithanaroy
Sep 01 2017 18:37
Thats great!
Runn Vermel
@runn-vermel
Sep 01 2017 18:40
@phillipskevin ++
Kevin Phillips
@phillipskevin
Sep 01 2017 18:43
does that mean it fixed the problem for you?
Nitin Pasumarthy
@Nithanaroy
Sep 01 2017 19:14

Worked with fixtures.

With real backend server it did not. The header is Content-Type:application/jsonis correct but the payload is still url-encoded.

Kevin Phillips
@phillipskevin
Sep 01 2017 19:26
can you post a screenshot of the headers?
Nitin Pasumarthy
@Nithanaroy
Sep 01 2017 20:12
Screen Shot 2017-09-01 at 1.11.48 PM.png
Nitin Pasumarthy
@Nithanaroy
Sep 01 2017 20:17
I just observed that even without mentioning the contentType attribute in baseMap.url, the Request header says application/json only