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

Skipping response body validation in hooks #510

Open
netmilk opened this issue Jun 3, 2016 · 1 comment
Open

Skipping response body validation in hooks #510

netmilk opened this issue Jun 3, 2016 · 1 comment

Comments

@netmilk
Copy link
Contributor

netmilk commented Jun 3, 2016

Hey, this is a little workaround solution how to skip body validation for some particular transaction using hooks. I'm considering making it part of the documentation.

var hooks = require('hooks');


// Names of transactions to skip the body validation
// Available tranasction names can be listed with `dredd --names`
skipBodyValidation = ['Emergency > Call first aid'];

skipBodyValidation.forEach(function(transactionName){
  hooks.beforeValidation(transactionName, function(transaction){
    hooks.log('Skipping body validation for transaction "'+ transactionName +'".');
    transaction['expected']['body'] = undefined;
    transaction['expected']['bodySchema'] = undefined;
  });
});
@jnj16180340
Copy link

This is also a convenient way to work around #883 while not ignoring the test case entirely!

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

No branches or pull requests

3 participants