Skip to content

Commit 741da19

Browse files
authored
Merge pull request #99 from fnproject/fix-fdk-version-header
fix value of fn-fdk-version to include the fdk language
2 parents ba54192 + 3f8a551 commit 741da19

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

fdk/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# under the License.
1414

1515
import sys
16+
from fdk import version
1617

1718
ASYNC_IO_READ_BUFFER = 65536
1819
DEFAULT_DEADLINE = 30
@@ -43,6 +44,8 @@
4344
FN_ENFORCED_RESPONSE_CODES = [200, 502, 504]
4445
FN_DEFAULT_RESPONSE_CODE = 200
4546

47+
VERSION_HEADER_VALUE = "fdk-python/" + version.VERSION
48+
4649

4750
# todo: python 3.8 is on its way, make more flexible
4851
def is_py37():

fdk/response.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
from fdk import context
1616
from fdk import constants
17-
from fdk import version
1817

1918

2019
class Response(object):
@@ -39,7 +38,8 @@ def __init__(self, ctx: context.InvokeContext,
3938
self.response_data = response_data if response_data else ""
4039
if headers is None:
4140
headers = {}
42-
headers.update({constants.FN_FDK_VERSION: version.VERSION})
41+
headers.update({constants.FN_FDK_VERSION:
42+
constants.VERSION_HEADER_VALUE})
4343
ctx.SetResponseHeaders(headers, status_code)
4444
self.ctx = ctx
4545

fdk/tests/test_http_stream.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from fdk import constants
2020
from fdk import event_handler
2121
from fdk import fixtures
22-
from fdk import version
2322

2423
from fdk.tests import funcs
2524

@@ -35,7 +34,8 @@ async def test_override_content_type():
3534
assert headers.get("content-type") == "application/json"
3635
# we've had issues with 'Content-Type: None' slipping in
3736
assert headers.get("Content-Type") is None
38-
assert version.VERSION == headers.get(constants.FN_FDK_VERSION)
37+
assert headers.get(
38+
constants.FN_FDK_VERSION) == constants.VERSION_HEADER_VALUE
3939

4040

4141
@pytest.mark.asyncio

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ flake8<2.7.0,>=2.6.0
22
hacking==1.1.0
33
pytest==4.0.1
44
pytest-cov==2.4.0
5+
attrs==19.1.0

0 commit comments

Comments
 (0)