Opened 7 years ago

Last modified 3 years ago

#16322 new enhancement

dojo/store/JsonRest add function does PUT with null in url

Reported by: HaraldOnline Owned by: Kris Zyp
Priority: undecided Milestone: 1.15
Component: Data Version: 1.8.1
Keywords: Cc:
Blocked By: Blocking:

Description

I'm trying to make my JS client-side code a little bit more robust (and better documented) by using dojo classes for my models.

When I include the id-column in the model as a property initialized with null and call the Json Rest store add function a HTTP PUT (=update) is performed with a null parameter for the id in the url. At least when calling add I would expect that an HTTP POST is performed every time.

This is especially true because all null-valued properties aren't sent to the server (neither on PUT nor POST) ...

While writing this I had the idea to use the value undefined for the id and it worked like it should (yes, I've been mostly coding in C# for the last years ;)

Nevertheless was the behavior unexpected and should be documented if not changed.

Change History (3)

comment:1 Changed 7 years ago by HaraldOnline

PS: While calling the JsonRest? store put method like

ctx._contextStore.put(this, { overwrite: true });

the store nevertheless tried a POST against my server (because it couldn't find the id). Why is the option overwrite not honored?

From http://dojotoolkit.org/reference-guide/1.8/dojo/store/JsonRest.html#id3

"A value of true [for overwrite] indicates that a new object should not be created"

comment:2 Changed 4 years ago by dylan

Milestone: tbd1.12

comment:3 Changed 3 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.