Commit 4d825607 authored by Tristan Cavelier's avatar Tristan Cavelier

localstorage.js putAttachment status code bug fix

was returning 201 or 200 instead of 204 or 201
parent a80625b7
...@@ -215,7 +215,7 @@ ...@@ -215,7 +215,7 @@
* @param {Object} options The command options * @param {Object} options The command options
*/ */
LocalStorage.prototype.putAttachment = function (command, param) { LocalStorage.prototype.putAttachment = function (command, param) {
var that = this, doc, status = "ok"; var that = this, doc, status = "created";
doc = this._storage.getItem(this._localpath + "/" + param._id); doc = this._storage.getItem(this._localpath + "/" + param._id);
if (doc === null) { if (doc === null) {
// the document does not exist // the document does not exist
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
jIO.util.readBlobAsBinaryString(param._blob).then(function (e) { jIO.util.readBlobAsBinaryString(param._blob).then(function (e) {
doc._attachments = doc._attachments || {}; doc._attachments = doc._attachments || {};
if (doc._attachments[param._attachment]) { if (doc._attachments[param._attachment]) {
status = "created"; status = "no_content";
} }
doc._attachments[param._attachment] = { doc._attachments[param._attachment] = {
"content_type": param._blob.type, "content_type": param._blob.type,
......
...@@ -344,8 +344,8 @@ ...@@ -344,8 +344,8 @@
"id": "putattmt1", "id": "putattmt1",
"method": "putAttachment", "method": "putAttachment",
"result": "success", "result": "success",
"status": 200, "status": 201,
"statusText": "Ok" "statusText": "Created"
}, "PutAttachment to a document, without data"); }, "PutAttachment to a document, without data");
}).then(function () { }).then(function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment