# HG changeset patch # User Alain Mazy # Date 1660736174 -7200 # Node ID f78f7ee6b660c6fc2e0e251966197b0f9fc2dd7e # Parent 75d8a5261f8242e6108a8eb5ff32f347823e9ac6 fix httpclient diff -r 75d8a5261f82 -r f78f7ee6b660 Database/Lua/HttpClient.lua --- a/Database/Lua/HttpClient.lua Wed Aug 17 09:37:47 2022 +0200 +++ b/Database/Lua/HttpClient.lua Wed Aug 17 13:36:14 2022 +0200 @@ -66,7 +66,6 @@ while retry > 0 and response == nil do print("HttpClient test: GET to httpbin.org") response = ParseJson(HttpGet('http://httpbin.org/get', httpHeaders)) - sleep(1) end testSucceeded = testSucceeded and (response['headers']['Content-Type'] == 'application/json' and response['headers']['Toto'] == 'Tutu') if not testSucceeded then print('Failed in HttpGet') PrintRecursive(response) end diff -r 75d8a5261f82 -r f78f7ee6b660 Tests/Tests.py --- a/Tests/Tests.py Wed Aug 17 09:37:47 2022 +0200 +++ b/Tests/Tests.py Wed Aug 17 13:36:14 2022 +0200 @@ -3908,13 +3908,15 @@ def test_httpClient_lua(self): - retries = 3 + retries = 4 result = '' with open(GetDatabasePath('Lua/HttpClient.lua'), 'r') as f: + scriptContent = f.read() # retry since this test sometimes fails if httpbin.org is unresponsive while retries > 0 and not ('OK' in result): - result = DoPost(_REMOTE, '/tools/execute-script', f.read(), 'application/lua') + print("Executing lua script HttpClient.lua") + result = DoPost(_REMOTE, '/tools/execute-script', scriptContent, 'application/lua') retries -= 1 self.assertIn('OK', result)