def test_post(self): data = 'hello world' try: response = httpc.post(self.base_url() + 'hello', data=data) self.assert_(False) except httpc.SeeOther, err: response = err.retry()
def test_post(self): data = 'hello world' try: response = httpc.post(self.base_url() + 'hello', data=data) self.assert_(False) except httpc.TemporaryRedirect, err: response = err.retry()
def test_post(self): data = 'qunge' try: response = httpc.post(self.base_url() + '', data=data) self.assert_(False) except httpc.MovedPermanently, err: response = err.retry()
def send(self, url, data=''): # Catch non-successful HTTP requests and treat them as if they were. try: result = httpc.post(url, data=data, content_type='application/json; charset=utf-8') except httpc.ConnectionError, exc: result = exc.params.response_body
def test_012_ssl_server(self): from eventlet import httpc def wsgi_app(environ, start_response): start_response('200 OK', {}) return [environ['wsgi.input'].read()] certificate_file = os.path.join(os.path.dirname(__file__), 'test_server.crt') private_key_file = os.path.join(os.path.dirname(__file__), 'test_server.key') sock = api.ssl_listener(('', 4201), certificate_file, private_key_file) api.spawn(wsgi.server, sock, wsgi_app) result = httpc.post("https://localhost:4201/foo", "abc") self.assertEquals(result, 'abc')
def test_post(self): # Simply ensure that a 504 status code results in a # GatewayTimeout. Don't bother retrying. data = 'hello world' self.assertRaises(httpc.GatewayTimeout, lambda: httpc.post(self.base_url(), data=data))
def test_post(self): data = 'qunge' self.assertEquals(httpc.post(self.base_url() + '', data=data), data)