Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
04b30adf
Commit
04b30adf
authored
Apr 04, 2011
by
Giorgos Verigakis
Browse files
Return correct content-type on faults
parent
b434dff5
Changes
1
Hide whitespace changes
Inline
Side-by-side
api/util.py
View file @
04b30adf
...
...
@@ -121,7 +121,16 @@ def render_fault(request, fault):
d
=
{
fault
.
name
:
{
'code'
:
fault
.
code
,
'message'
:
fault
.
message
,
'details'
:
fault
.
details
}}
data
=
json
.
dumps
(
d
)
return
HttpResponse
(
data
,
status
=
fault
.
code
)
resp
=
HttpResponse
(
data
,
status
=
fault
.
code
)
if
request
.
serialization
==
'xml'
:
resp
[
'Content-Type'
]
=
'application/xml'
elif
request
.
serialization
==
'atom'
:
resp
[
'Content-Type'
]
=
'application/atom+xml'
else
:
resp
[
'Content-Type'
]
=
'application/json'
return
resp
def
request_serialization
(
request
,
atom_allowed
=
False
):
"""Return the serialization format requested.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment