title: How would I change a ServiceStack response DTO
body: <p>I'm working on an API where I'd like to be able to customize the response structure based on a parameter from the client. Response filters seem like a good place to do this in order to avoid doing so in each service or action. The problem is that while I have access to the response DTO returned by the action, and could change its properties, I can't find how or where to replace the object entirely. </p>
  
  <p>Naively replacing the object in the response filter did not work, but this help illustrate what I'm trying to do:</p>
  
  <pre><code>public class ChangeResponseAttribute : ResponseFilterAttribute
  {
      public override void Execute(IHttpRequest req, IHttpResponse res, object responseDto)
      {
          var overrideText = req.QueryString["override"];
          if (!String.IsNullOrEmpty(overrideText))
              responseDto = new { Message = overrideText };
      }
  }
  
  [ChangeResponse]
  public class TodosService : Service
  {
      public object Get(Todos request)
      {
          return new object[0];
      }
  }
  </code></pre>
  
  <p>It looks like another option would be to write the custom response directly &amp; end the request, but that would bypass any other processing left to do by ServiceStack.</p>
  
  <p>Is there a better place to do this than a response filter? Or do I need to bite the bullet and return the optimal DTO in each action?</p>