Skip to content

Commit 339ad7a

Browse files
Merge pull request #760 from timothycrosley/develop
2.4.7 release
2 parents 0e305b5 + fc6362d commit 339ad7a

File tree

7 files changed

+25
-5
lines changed

7 files changed

+25
-5
lines changed

.bumpversion.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 2.4.6
2+
current_version = 2.4.7
33

44
[bumpversion:file:.env]
55

.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fi
1111

1212
export PROJECT_NAME=$OPEN_PROJECT_NAME
1313
export PROJECT_DIR="$PWD"
14-
export PROJECT_VERSION="2.4.6"
14+
export PROJECT_VERSION="2.4.7"
1515

1616
if [ ! -d "venv" ]; then
1717
if ! hash pyvenv 2>/dev/null; then

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Ideally, within a virtual environment.
1313
Changelog
1414
=========
1515

16+
### 2.4.7 - March 28, 2019
17+
- Fixed API documentation with selectable output types
18+
1619
### 2.4.6 - March 25, 2019
1720
- Fixed issue #753 - 404 not found does not respect default output format.
1821
- Documented the `--without-cython` option in `CONTRIBUTING.md`

hug/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
"""
2222
from __future__ import absolute_import
2323

24-
current = "2.4.6"
24+
current = "2.4.7"

hug/api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def handle_404(request, response, *args, **kwargs):
310310
response.data = hug.output_format.json(to_return, indent=4, separators=(',', ': '))
311311
response.content_type = 'application/json; charset=utf-8'
312312
else:
313-
response.data = self.output_format(to_return)
313+
response.data = self.output_format(to_return, request=request, response=response)
314314
response.content_type = self.output_format.content_type
315315

316316
response.status = falcon.HTTP_NOT_FOUND

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def list_modules(dirname):
7575

7676
setup(
7777
name='hug',
78-
version='2.4.6',
78+
version='2.4.7',
7979
description='A Python framework that makes developing APIs '
8080
'as simple as possible, but no simpler.',
8181
long_description=long_description,

tests/test_documentation.py

+17
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
2121
"""
2222
import json
23+
from unittest import mock
2324

2425
import marshmallow
2526
from falcon import Request
@@ -149,6 +150,22 @@ def extend_with():
149150
assert '/echo' in documentation['handlers']
150151
assert '/test' not in documentation['handlers']
151152

153+
154+
def test_basic_documentation_output_type_accept():
155+
"""Ensure API documentation works with selectable output types"""
156+
accept_output = hug.output_format.accept(
157+
{'application/json': hug.output_format.json,
158+
'application/pretty-json': hug.output_format.pretty_json},
159+
default=hug.output_format.json)
160+
with mock.patch.object(api.http, '_output_format', accept_output, create=True):
161+
handler = api.http.documentation_404()
162+
response = StartResponseMock()
163+
164+
handler(Request(create_environ(path='v1/doc')), response)
165+
166+
documentation = json.loads(response.data.decode('utf8'))['documentation']
167+
assert 'handlers' in documentation and 'overview' in documentation
168+
152169

153170
def test_marshmallow_return_type_documentation():
154171

0 commit comments

Comments
 (0)