Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #382 from patrickw276/content-type
fix content-type header bug
- Loading branch information
Showing
3 changed files
with
18 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import flask | ||
from connexion.decorators.decorator import ResponseContainer | ||
|
||
|
||
def test_response_container_content_type(): | ||
app = flask.Flask(__name__) | ||
response = flask.Response(response='test response', content_type='text/plain') | ||
container = ResponseContainer(mimetype='application/json', response=response) | ||
|
||
with app.app_context(): | ||
headers = container.flask_response_object().headers | ||
|
||
content_types = [value for key, value in headers.items() if key == 'Content-Type'] | ||
assert len(content_types) == 1 | ||
assert content_types[0] == 'text/plain' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters