Commit 93888b58 authored by Jonathan Rivalan's avatar Jonathan Rivalan

Validation for get test

parent 713a80e2
...@@ -312,11 +312,14 @@ ...@@ -312,11 +312,14 @@
break; break;
case 'GET': case 'GET':
if (jio === true) { if (jio === true) {
if (typeof this.responseText !== 'string') { console.log(http);
console.log(obj);
console.log(typeof this.responseText);
if (typeof this.responseText === 'string') {
response = JSON.parse(this.responseText); response = JSON.parse(this.responseText);
response._attachments = response._attachments || {}; //response._attachments = response._attachments || {};
delete response._attachments; //delete response._attachments;
//command.success(JSON.stringify(response)); command.success(this.status,{'data':response});
} else { } else {
if (isAttachment === true) { if (isAttachment === true) {
//command.success(this.responseText); //command.success(this.responseText);
...@@ -618,10 +621,11 @@ ...@@ -618,10 +621,11 @@
**/ **/
that.put = function (command, metadata, options) { that.put = function (command, metadata, options) {
var doc, docId, mime; var doc, docId, mime, created;
doc = metadata; doc = metadata;
docId = doc._id; docId = doc._id;
mime = 'text/plain; charset=UTF-8'; mime = 'text/plain; charset=UTF-8';
created = false;
//pas d'attachment dans un put simple //pas d'attachment dans un put simple
function putDocument() { function putDocument() {
var attachId, data, isJIO; var attachId, data, isJIO;
...@@ -645,6 +649,7 @@ ...@@ -645,6 +649,7 @@
doc._attachments = response._attachments; doc._attachments = response._attachments;
} }
putDocument(); putDocument();
//TODO : control non existing document to throw a 201 http code
} }
); );
}; };
......
...@@ -936,7 +936,7 @@ ...@@ -936,7 +936,7 @@
// put 201 // put 201
putNewDocument().then(putNewDocumentTest). putNewDocument().then(putNewDocumentTest).
// get 200 // get 200
//then(getCreatedDocument2).then(getCreatedDocument2Test). then(getCreatedDocument2).then(getCreatedDocument2Test).
// post 409 // post 409
//then(postSameDocument).then(postSameDocumentTest). //then(postSameDocument).then(postSameDocumentTest).
// putA a 204 // putA a 204
......
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