Skip to content

Commit

Permalink
Merge pull request #760 from timothycrosley/develop
Browse files Browse the repository at this point in the history
2.4.7 release
  • Loading branch information
timothycrosley authored Mar 28, 2019
2 parents 0e305b5 + fc6362d commit 339ad7a
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.4.6
current_version = 2.4.7

[bumpversion:file:.env]

Expand Down
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fi

export PROJECT_NAME=$OPEN_PROJECT_NAME
export PROJECT_DIR="$PWD"
export PROJECT_VERSION="2.4.6"
export PROJECT_VERSION="2.4.7"

if [ ! -d "venv" ]; then
if ! hash pyvenv 2>/dev/null; then
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Ideally, within a virtual environment.
Changelog
=========

### 2.4.7 - March 28, 2019
- Fixed API documentation with selectable output types

### 2.4.6 - March 25, 2019
- Fixed issue #753 - 404 not found does not respect default output format.
- Documented the `--without-cython` option in `CONTRIBUTING.md`
Expand Down
2 changes: 1 addition & 1 deletion hug/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
"""
from __future__ import absolute_import

current = "2.4.6"
current = "2.4.7"
2 changes: 1 addition & 1 deletion hug/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def handle_404(request, response, *args, **kwargs):
response.data = hug.output_format.json(to_return, indent=4, separators=(',', ': '))
response.content_type = 'application/json; charset=utf-8'
else:
response.data = self.output_format(to_return)
response.data = self.output_format(to_return, request=request, response=response)
response.content_type = self.output_format.content_type

response.status = falcon.HTTP_NOT_FOUND
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def list_modules(dirname):

setup(
name='hug',
version='2.4.6',
version='2.4.7',
description='A Python framework that makes developing APIs '
'as simple as possible, but no simpler.',
long_description=long_description,
Expand Down
17 changes: 17 additions & 0 deletions tests/test_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""
import json
from unittest import mock

import marshmallow
from falcon import Request
Expand Down Expand Up @@ -149,6 +150,22 @@ def extend_with():
assert '/echo' in documentation['handlers']
assert '/test' not in documentation['handlers']


def test_basic_documentation_output_type_accept():
"""Ensure API documentation works with selectable output types"""
accept_output = hug.output_format.accept(
{'application/json': hug.output_format.json,
'application/pretty-json': hug.output_format.pretty_json},
default=hug.output_format.json)
with mock.patch.object(api.http, '_output_format', accept_output, create=True):
handler = api.http.documentation_404()
response = StartResponseMock()

handler(Request(create_environ(path='v1/doc')), response)

documentation = json.loads(response.data.decode('utf8'))['documentation']
assert 'handlers' in documentation and 'overview' in documentation


def test_marshmallow_return_type_documentation():

Expand Down

0 comments on commit 339ad7a

Please sign in to comment.