Saturday, October 13, 2012

content_type in Client() post doesn't correctly encode

I think I may have a bug in the client test class in the post method.  Normally you can call:
    url_data = {'something': 'something'}
    response = c.post(ip, url_data, content_type='application/xml')

When I do this I get a 401 response and this data:
Content-Type: text/html; charset=utf-8

That's it. I don't get any actual data. If I remove the content_type argument the problem goes away (but I have the default content type which I don't want

I have come across this problem because I am testing an api and it requires the content-type to be application/xml.

How do I specify content_type correctly in Django's testing client with post data?  



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/iCT4nxbil_QJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate