Skip to content

Commit

Permalink
Use content_type instead of mimetype in Response
Browse files Browse the repository at this point in the history
  • Loading branch information
juliomalegria committed Jan 28, 2015
1 parent ea14cc2 commit 555bad0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
9 changes: 7 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,17 @@ Add any of these variables into your project settings to override them.
* Function used to encode response data. Receives a dict and returns a string
* Default: ``DjangoJSONEncoder().encode``

``CHUNKED_UPLOAD_MIMETYPE``
``CHUNKED_UPLOAD_CONTENT_TYPE``
~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Mimetype for the response data.
* Content-Type for the response data.
* Default: ``'application/json'``

``CHUNKED_UPLOAD_MIMETYPE``
~~~~~~~~~~~~~~~~~~~~~~~~~~~

* **Deprecated**, use ``CHUNKED_UPLOAD_CONTENT_TYPE`` instead.

``CHUNKED_UPLOAD_MAX_BYTES``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.2
1.0.3
4 changes: 2 additions & 2 deletions chunked_upload/response.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.http import HttpResponse

from .settings import ENCODER, MIMETYPE
from .settings import ENCODER, CONTENT_TYPE


class Response(HttpResponse):
Expand All @@ -10,7 +10,7 @@ class Response(HttpResponse):
def __init__(self, content, status=None, *args, **kwargs):
super(Response, self).__init__(
content=ENCODER(content),
mimetype=MIMETYPE,
content_type=CONTENT_TYPE,
status=status,
*args, **kwargs
)
12 changes: 9 additions & 3 deletions chunked_upload/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@
ENCODER = getattr(settings, 'CHUNKED_UPLOAD_ENCODER', DEFAULT_ENCODER)


# Mimetype for the response data
DEFAULT_MIMETYPE = 'application/json'
MIMETYPE = getattr(settings, 'CHUNKED_UPLOAD_MIMETYPE', DEFAULT_MIMETYPE)
# Content-Type for the response data
DEFAULT_CONTENT_TYPE = 'application/json'
CONTENT_TYPE = getattr(settings, 'CHUNKED_UPLOAD_CONTENT_TYPE',
DEFAULT_CONTENT_TYPE)


# CHUNKED_UPLOAD_MIMETYPE is deprecated, but kept for backward compatibility
CONTENT_TYPE = getattr(settings, 'CHUNKED_UPLOAD_MIMETYPE',
DEFAULT_CONTENT_TYPE)


# Max amount of data (in bytes) that can be uploaded. `None` means no limit
Expand Down

0 comments on commit 555bad0

Please sign in to comment.