benim kodunda 404 HTTP hata yolunu test etmek istediğinizde aşağıdaki hatayı alıyorum: Ben bu davranışı tetikleyen minimal örneğini oluşturdukİçerik uzunlukta hatası
AssertionError: Content-Length is different from actual app_iter length (512!=60)
:
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'})
Peki ne yapıyorum yanlış?
çalışıyor olacak? Tahminimce ... – Veedrac
Bende - sunucuda bir uç nokta istisnası oluşturduğunuzda olur. Bu http://trac.turbogears.org/ticket/2454'ü buldum, ancak yine de düzeltmedim - Ne zaman yaptığımı bileceğim :) –