Permalink
Browse files

Merge pull request #27 from kriszyp/master

0.3.2 updates
  • Loading branch information...
2 parents 26b5e47 + e5f8445 commit 9f1e7dd8f76e80b2d2e9d45d508e4456ef856210 @kriszyp kriszyp committed Oct 23, 2013
Showing with 15 additions and 8 deletions.
  1. +10 −6 jsgi/metadata.js
  2. +3 −1 jsgi/rest-store.js
  3. +1 −0 media.js
  4. +1 −1 package.json
View
@@ -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){
View
@@ -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) == '/')){
View
@@ -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};
View
@@ -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",

0 comments on commit 9f1e7dd

Please sign in to comment.