♻️(backend) pass API token to Yprovider with scheme Bearer
Signed-off-by: Stephan Meijer <me@stephanmeijer.com>
This commit is contained in:
@@ -26,7 +26,7 @@ class YdocConverter:
|
||||
def auth_header(self):
|
||||
"""Build microservice authentication header."""
|
||||
# Note: Yprovider microservice accepts only raw token, which is not recommended
|
||||
return settings.Y_PROVIDER_API_KEY
|
||||
return f"Bearer {settings.Y_PROVIDER_API_KEY}"
|
||||
|
||||
def convert(self, text):
|
||||
"""Convert a Markdown text into our internal format using an external microservice."""
|
||||
|
||||
@@ -17,7 +17,7 @@ def test_auth_header(settings):
|
||||
"""Test authentication header generation."""
|
||||
settings.Y_PROVIDER_API_KEY = "test-key"
|
||||
converter = YdocConverter()
|
||||
assert converter.auth_header == "test-key"
|
||||
assert converter.auth_header == "Bearer test-key"
|
||||
|
||||
|
||||
def test_convert_empty_text():
|
||||
@@ -82,7 +82,7 @@ def test_convert_full_integration(mock_post, settings):
|
||||
"http://test.com/conversion-endpoint/",
|
||||
data="test markdown",
|
||||
headers={
|
||||
"Authorization": "test-key",
|
||||
"Authorization": "Bearer test-key",
|
||||
"Content-Type": "text/markdown",
|
||||
},
|
||||
timeout=5,
|
||||
|
||||
Reference in New Issue
Block a user