Skip to content

Commit

Permalink
Merge pull request persvr#27 from kriszyp/master
Browse files Browse the repository at this point in the history
0.3.2 updates
  • Loading branch information
kriszyp committed Oct 23, 2013
2 parents 26b5e47 + e5f8445 commit 9f1e7dd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
16 changes: 10 additions & 6 deletions jsgi/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ exports.Metadata = function(nextApp){
// first add metadata to the incoming request
if(request.method !== "GET"){
if(input.__proto__ === Object.prototype){
input.__proto__ = {
getMetadata: function(){
Object.defineProperty(input.__proto__ = {}, 'getMetadata', {
value: function(){
return request.headers;
}
};
},
enumerable: false
});
}
if(input.__proto__ === Array.prototype){
(input.__proto__ = []).getMetadata = function(){
Object.defineProperty(input.__proto__ = [], 'getMetadata', {
value: function(){
return request.headers;
};
},
enumerable: false
});
}
}
return when(nextApp(request), function(response){
Expand Down
4 changes: 3 additions & 1 deletion jsgi/rest-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ exports.RestStore = function(options){
};
}
}
metadata.id = decodeURIComponent(path);
if(path){
metadata.id = decodeURIComponent(path);
}

if(!METHOD_HAS_BODY[method]){
if(method === "get" && (!path || path.charAt(path.length-1) == '/')){
Expand Down
1 change: 1 addition & 0 deletions media.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ exports.saveFile = function(file, directives){
metadata[i] = file[i];
}
}
file['content-type'] = file['content-type'] || file.type;
return when(exports.getFileModel().put(file, directives), function(result){
var id = result.id || result;
result = {id: id, getMetadata: result.getMetadata};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pintura",
"version": "0.3.1",
"version": "0.3.2",
"author": "Kris Zyp",
"email": "kriszyp@gmail.com",
"description": "JSGI-based RESTful JSON/JavaScript server",
Expand Down

0 comments on commit 9f1e7dd

Please sign in to comment.