Skip to content

Commit

Permalink
Make metadata dontEnum.
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Oct 10, 2013
1 parent 9e0d3d1 commit 7fb167c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions jsgi/metadata.js
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

0 comments on commit 7fb167c

Please sign in to comment.