Opened 7 years ago
Closed 7 years ago
#17636 closed feature (wontfix)
store/JsonRest: add option to send post/put as text
Reported by: | Simon Speich | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Data | Version: | 1.9.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
It would be nice if I could have my data posted as a plain POST/PUT. This could be easily provided with an addtional options property (e.g. options.postString} as shown below.
put: function(object, options) { options = options || {}; var id = ("id" in options) ? options.id : this.getIdentity(object); var hasId = typeof id != "undefined"; return xhr(hasId && !options.incremental ? "PUT" : "POST", { url: hasId ? this.target + id : this.target, postData: options.postString ? object : JSON.stringify(object), handleAs: "json", headers: lang.mixin({ "Content-Type": options.postString ? "text/html" : "application/json", Accept: this.accepts, "If-Match": options.overwrite === true ? "*" : null, "If-None-Match": options.overwrite === false ? "*" : null }, this.headers, options.headers) }); }
If you work with PHP on the server it's more convenient to be able to access $_POST variables direcly instead of having to json_decode() everything first.
Note: The response will still be JSON.
Change History (2)
comment:1 Changed 7 years ago by
comment:2 Changed 7 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
JsonRest? is a two-way JSON store only. You may want to look at e.g. https://github.com/kfranqueiro/dojo-smore/blob/master/QueryRead.js instead.
Note: See
TracTickets for help on using
tickets.
Correction for Content-Type":