Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Standalone attachments api for remote couchdb

  • Loading branch information...
commit e1362fa2abe64d12a3d4e8fe7beb079135f5359a 1 parent 2d3bd39
@daleharvey daleharvey authored
Showing with 13 additions and 4 deletions.
  1. +13 −4 src/pouch.js
View
17 src/pouch.js
@@ -122,8 +122,8 @@ parseUri.options = {
var ajax = function (options, callback) {
var defaults = {
- success: function (obj) {
- callback(null, obj);
+ success: function (obj, _, xhr) {
+ callback(null, obj, xhr);
},
error: function (err) {
if (err) callback(err);
@@ -372,15 +372,24 @@ parseUri.options = {
options.dataType = false;
}
- ajax(options, function(err, doc) {
+ ajax(options, function(err, doc, xhr) {
if (err) {
return call(callback, Errors.MISSING_DOC);
}
- call(callback, null, doc);
+ call(callback, null, doc, xhr);
});
};
db.remove = function(doc, opts, callback) {
};
+ db.putAttachment = function(id, doc, type, callback) {
+ ajax({
+ auth: host.auth,
+ type:'PUT',
+ url: genUrl(host, id),
+ headers: {'Content-Type': type},
+ data: doc
+ }, callback);
+ };
db.put = db.post = function(doc, opts, callback) {
if (opts instanceof Function) {
callback = opts;

0 comments on commit e1362fa

Please sign in to comment.
Something went wrong with that request. Please try again.