mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-07 22:04:48 +03:00
Only set 'encoding' if a 'form' or 'body' field exists
This commit is contained in:
parent
2f5c9748d3
commit
e78753dd0c
|
@ -197,7 +197,7 @@ class SchemaGenerator(object):
|
||||||
fields += self.get_pagination_fields(path, method, callback, view)
|
fields += self.get_pagination_fields(path, method, callback, view)
|
||||||
fields += self.get_filter_fields(path, method, callback, view)
|
fields += self.get_filter_fields(path, method, callback, view)
|
||||||
|
|
||||||
if fields:
|
if fields and any([field.location in ('form', 'body') for field in fields]):
|
||||||
encoding = self.get_encoding(path, method, callback, view)
|
encoding = self.get_encoding(path, method, callback, view)
|
||||||
else:
|
else:
|
||||||
encoding = None
|
encoding = None
|
||||||
|
@ -213,9 +213,6 @@ class SchemaGenerator(object):
|
||||||
"""
|
"""
|
||||||
Return the 'encoding' parameter to use for a given endpoint.
|
Return the 'encoding' parameter to use for a given endpoint.
|
||||||
"""
|
"""
|
||||||
if method not in set(('POST', 'PUT', 'PATCH')):
|
|
||||||
return None
|
|
||||||
|
|
||||||
# Core API supports the following request encodings over HTTP...
|
# Core API supports the following request encodings over HTTP...
|
||||||
supported_media_types = set((
|
supported_media_types = set((
|
||||||
'application/json',
|
'application/json',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user