-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Added a function setHeader(name, value) to the context object that we pass to the component data function. * Subsequently these headers (if added) will be set in the response data in the returned component JSON as well as response headers (component.js) * Added a mock component (response-headers-component) and a test to cover the new functionality
- Loading branch information
1 parent
705afbd
commit cc2fdff
Showing
5 changed files
with
93 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
package: { | ||
name: 'response-headers-component', | ||
version: '1.0.0', | ||
oc: { | ||
container: false, | ||
renderInfo: false, | ||
files: { | ||
template: { | ||
type: 'jade', | ||
hashKey: '8c1fbd954f2b0d8cd5cf11c885fed4805225749f', | ||
src: 'template.js' | ||
}, | ||
dataProvider: { | ||
type: 'node.js', | ||
hashKey: '123456', | ||
src: 'server.js' | ||
} | ||
} | ||
} | ||
}, | ||
data: '"use strict";module.exports.data = function(ctx, cb){ctx.setHeader("test-header","test-value"); cb(null, {done:true});};', | ||
view: 'var oc=oc||{};oc.components=oc.components||{},oc.components["8c1fbd954f2b0d8cd5cf11c885fed4805225749f"]' + | ||
'=function(){var o=[];return o.push("<div>hello</div>"),o.join("")};' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters