     startJson = jsonPart.indexOf '{'
     endJson = jsonPart.lastIndexOf '}'
     json = jsonPart.substring startJson, endJson+1
-    console.log json
     return [null, JSON.parse(json)]
 
 

            unless err
                # Check doc
                err = checkPermissions req, doc.docType
                console.log err
                if err
                    res.send 403, err
                    stream.emit 'end'
                    couchReq.end()

    if req.body and options.headers['Content-Type'] is 'application/json'
        if req.body? and Object.keys(req.body).length > 0
            bodyToTransmit = JSON.stringify req.body
            options['body'] = bodyToTransmit
            # Check doc : bodyToTransmit
            err = checkPermissions req, bodyToTransmit.docType
