-
Notifications
You must be signed in to change notification settings - Fork 116
Extend usage to restify #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -166,7 +166,11 @@ module.exports = (function () { | |
| /** if it's cached, display cache **/ | ||
|
|
||
| if ( cache.length ) { | ||
| res.contentType(cache[0].type || "text/html"); | ||
| if (res.contentType) { | ||
| res.contentType(cache[0].type || "text/html"); | ||
| } else if (res.setHeader) { | ||
| res.setHeader('content-type', cache[0].type || "text/html"); | ||
| } | ||
|
||
| if(binary){ //Convert back to binary buffer | ||
| res.send(new Buffer(cache[0].body, 'base64')); | ||
| }else{ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can avoid this conditional by using
res.headerwhich is supported by Express v4.x and Restify.