Open punto-bi opened 4 years ago
You just have to specify the content-type to solve this issue, for example:
client = TenantClient(self.tenant)
data = {
"first_name": "",
"last_name": ""
}
response = client.put(url, data=data, content_type="application/json")
That should work :D
Also, I notice that you use the url "/api/v1/auth/user". Depending on how you set up your url conf in rest framework, this can trigger a redirect if you define the url as "/api/v1/auth/user/" (trailing slash)
First of all, thanks for your hard work in creating this package. It's really usefull. I've been learning how to use it this last week and until now, I have made a lot of progress. But I'm stuck testing my REST app.
I'm using
Django==3.0.7
anddjangorestframework==3.11.0
. POST method work fine, but PUT and PATCH methods return the status code = 415.This is the format that I'm using for testing:
Where
tenant = TenantClient(self.tenant)
I tried to scpecify the format
content_type='application/json'
, but it kept returning the same error.Also I tried parsing the dict to json:
data=json.dumps(http_request)
, but it doesn't work either.Is there another way to test both methods?
Thanks