title: Return different type of data as per the condition
body: <p>I have a problem in which if in a method, called by a rest end point, I have an errorlog then the method should return a file. Otherwise, if everything is correct, it should return a json.</p>
  
  <p>Is there any way to change return type of method as per the condition?</p>