Default the Accept header to */* if there isn't one provided
This commit is contained in:
parent
e8214b45ef
commit
d87d49e67b
1 changed files with 2 additions and 1 deletions
|
@ -26,7 +26,8 @@ def uri(request):
|
||||||
|
|
||||||
|
|
||||||
def choose_type(request, content, reps):
|
def choose_type(request, content, reps):
|
||||||
type = get_best_match(request.META.get('HTTP_ACCEPT'), reps.keys())
|
accept = request.META.get('HTTP_ACCEPT', '*/*')
|
||||||
|
type = get_best_match(accept, reps.keys())
|
||||||
if type:
|
if type:
|
||||||
return reps[type](content)
|
return reps[type](content)
|
||||||
return HttpResponse(status=406)
|
return HttpResponse(status=406)
|
||||||
|
|
Loading…
Reference in a new issue