Skip to content

Conversation

@willfarrell
Copy link

when using restify; res.contentType generates:

{ [TypeError: res.contentType is not a function]
  domain: 
   Domain {
     domain: null,
     _events: { error: [Function] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] },
  domainThrown: true }

when using restify; res.contentType generates:
```
{ [TypeError: res.contentType is not a function]
  domain: 
   Domain {
     domain: null,
     _events: { error: [Function] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] },
  domainThrown: true }
```
res.contentType(cache[0].type || "text/html");
} else if (res.setHeader) {
res.setHeader('content-type', cache[0].type || "text/html");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like spaces are being used elsewhere in this project. Would you consider uses spaces instead of tabs for consistency?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol, serves me right for doing it in the browser. All fixed.


if ( cache.length ) {
res.contentType(cache[0].type || "text/html");
if (res.contentType) {

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.header which is supported by Express v4.x and Restify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants