Skip to content

Commit

Permalink
Allow put to take success and error callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
clalimarmo committed Dec 20, 2014
1 parent 3b49075 commit 7db3816
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/json-gcs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions lib/json-gcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ define(function() {
return onlyDependencies;
};

var boundary = 'foo-bar-baz';
var boundary = '32478901278409';
var multipartDelimiter = '\r\n--' + boundary + '\r\n';
var multipartCloseDelimiter = '\r\n--' + boundary + '--';

Expand Down Expand Up @@ -59,10 +59,11 @@ define(function() {
);
};

instance.put = function(name, doc, metadata) {
instance.put = function(name, doc, opts) {
opts = opts || {};
var topLevelMetadata = {
name: name,
metadata: metadata,
metadata: opts.metadata,
};
var requestBody = multipartDelimiter +
'Content-Type: application/json; charset=UTF-8\r\n\r\n' +
Expand All @@ -79,7 +80,9 @@ define(function() {
'Authorization': authHeader(),
'Content-Type': 'multipart/related; boundary="' + boundary + '"',
},
data: requestBody
data: requestBody,
success: opts.success,
error: opts.error,
}
);
};
Expand Down

0 comments on commit 7db3816

Please sign in to comment.