Validator is not responding with JSON


#1

Well, I’ve read in docs that Validator will read the Accept: application/json header and respond with JSON if presented. So I decided to use it for API, basically I have the same validator for API login method and for session method.
But for some sort of reason it is not working in my setup, tried everything, so need some help, maybe I do not catch something.
My validator, as an example:

'use strict'

class Login {

  get rules () {
    return {
      email: 'required|email',
      password: 'required'
    }
  }

  get sanitizationRules() {
    return {
      email: 'normalize_email'
    }
  }

  get messages () {
    return {
      'email.required': 'Email is required to login to your account',
      'email.email': 'Enter a valid email address to login to your account',
      'password.required': 'Enter your account password'
    }
  }

}

module.exports = Login

#2

Okay, resolved, had to update ExceptionHandler a bit :slight_smile: