This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

DRF URL Content Type Override

DRF URL Content Type Override allows the content type of the request to be overriden with a url parameter.

Why would I need this?

Sometimes it makes sense to override the content type specified in the header. For example, some browser’s XHR, such as IE9, are unable to support CORS. Pollyfills like, jQuery-ajaxTransport-XDomainRequest or httpplease’s oldiexdomain.js plug-in get around this by using XDomainRequest, which supports CORS. The problem is XDomainRequest only sends a content type of text/plain in the header. This is problematic when POSTing form data. DRF URL Content Type Override let’s you specify a content type which will override the header value.

Install

pip install drf-url-content-type-override

Add ‘DEFAULT_CONTENT_NEGOTIATION_CLASS’

REST_FRAMEWORK = {
  'DEFAULT_CONTENT_NEGOTIATION_CLASS': 'drf_url_content_type_override.URLOverrideContentNegotiation',
}

Usage

Example: Javascript on a different domain from the API.

jquery.ajax({
  'url': 'http://apidomain.com/api/1/contact?_content_type=application/x-www-form-urlencoded',
  'type': 'POST',
  'data': {'name': 'Chris'}
})

For more background see https://github.com/tomchristie/django-rest-framework/pull/1731

Release History

Release History

1.0.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
drf-url-content-type-override-1.0.0.tar.gz (3.4 kB) Copy SHA256 Checksum SHA256 Source Dec 8, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting