How to work with DELETE request and X-Auth-Token

1.7k views Asked by At

I want DELETE operation be allowed only after authentication/authorization process. I tried to do a DELETE operation passing an X-Auth-Token, but I got this: The status of this operation is: 400 Some error occurred! {"error":"BadRequest","description":"Orion accepts no payload for GET/DELETE requests. HTTP header Content-Type is thus forbidden"}

I did this with GET request, without problem, but it is not working for DELETE.

headers = {'X-Auth-Token': token}
s = Session()  
request = Request('DELETE', DELETE_URL + entity_id, headers=headers)
prepped = request.prepare()
del prepped.headers['Content-Length']
r = s.send(prepped)
2

There are 2 answers

0
Dalton Cézane On BEST ANSWER

Problem solved, like @fgalan told in previous comments. A fix was made at PEP Proxy Wilma, as it can be seen here

13
Jose Manuel Cantera On

You should remove the content-type header as suggested by the error message.