Fix calculator instance auth header to X-Hub-Token.

Market info fetch was rejected by instances because it sent the wrong bridge token header; align with hub monitor calls.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-23 18:17:42 +08:00
parent 5e507d0b66
commit f78ea1288e
2 changed files with 8 additions and 2 deletions
+6
View File
@@ -58,6 +58,12 @@ class HubCalculatorMarketLibTests(unittest.TestCase):
self.assertEqual(fn(1.23456), 1.234)
self.assertIsNone(fn(0.0001))
@patch.dict("os.environ", {"HUB_BRIDGE_TOKEN": "test-token"}, clear=False)
def test_hub_headers_use_x_hub_token(self):
from hub_calculator_market_lib import _hub_headers
self.assertEqual(_hub_headers(), {"X-Hub-Token": "test-token"})
@patch("hub_calculator_market_lib.fetch_instance_market_sync")
def test_get_calculator_market_from_instance(self, fetch_mock):
fetch_mock.return_value = {