Skip to content
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

Bugfix #1793

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Bugfix #1793

wants to merge 1 commit into from

Commits on Jun 24, 2019

  1. Bugfix

    When using the **conditionalHandler** plugin, if a single version route has a `contentType`, but the other routes do not, it will crash as it tries to call `.join` on a undefined `contentType` field.
    
    See for yourself:
    
    ``` bug.js
    const restify = require('restify');
    
    const server = restify.createServer();
    
    server.get('/', restify.plugins.conditionalHandler([
      {
        contentType: ['application/json'],
        version: '1.5.0', 
        handler: (req, res, next) => {
          res.json({
            version: 0
          })
        }
      },
      {
        // contentType is missing here
        version: '1.1.0', 
        handler: (req, res, next) => {
          res.json({
            version: 1
          })
        }
      }
    ]));
    ```
    carlosascari authored Jun 24, 2019
    Configuration menu
    Copy the full SHA
    f470157 View commit details
    Browse the repository at this point in the history