title: Content-length error in google cloud endpoints testing
body: <p>I get the following error whenever I want to test a 404 HTTP error path in my code:</p>
  
  <blockquote>
    <p>AssertionError: Content-Length is different from actual app_iter length (512!=60)</p>
  </blockquote>
  
  <p>I have created a minimal sample that triggers this behavior:</p>
  
  <pre><code>import unittest
  import endpoints
  from protorpc import remote
  from protorpc.message_types import VoidMessage
  import webtest
  
  @endpoints.api(name='test', version='v1')
  class HelloWorld(remote.Service):
      @endpoints.method(VoidMessage, VoidMessage,
                        path='test_path', http_method='POST',
                        name='test_name')
      def test(self, request):
          raise endpoints.NotFoundException("Not found")
  
  class AppTest(unittest.TestCase):
      def setUp(self):
          app = endpoints.api_server([HelloWorld])
          self.testapp = webtest.TestApp(app)
  
      # Test the handler.
      def testHelloWorldHandler(self):
          response = self.testapp.post('/_ah/spi/HelloWorld.test', extra_environ={
              'SERVER_SOFTWARE': 'Development/X', 'CONTENT_TYPE': 'application/json'})
  </code></pre>
  
  <p>So what am I doing wrong?</p>