{ "info": { "author": "Chris McKenzie", "author_email": "me@christophermckenzie.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP" ], "description": "DRF URL Content Type Override\n===================================================\n\nDRF URL Content Type Override allows the content type of the request to be overriden with a url parameter.\n\n\nWhy would I need this?\n=============================\nSometimes 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.\n\n.. _`jQuery-ajaxTransport-XDomainRequest`: https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest\n.. _`oldiexdomain.js`: https://github.com/matthewwithanm/httpplease.js/blob/master/plugins/oldiexdomain.js\n\n\nInstall\n-------------\n\n.. code-block:: shell\n\n pip install drf-url-content-type-override\n\nAdd 'DEFAULT_CONTENT_NEGOTIATION_CLASS'\n\n.. code-block:: python\n\n REST_FRAMEWORK = {\n 'DEFAULT_CONTENT_NEGOTIATION_CLASS': 'drf_url_content_type_override.URLOverrideContentNegotiation',\n }\n\n\nUsage\n-------------\nExample: Javascript on a different domain from the API.\n\n.. code-block:: javascript\n\n jquery.ajax({\n 'url': 'http://apidomain.com/api/1/contact?_content_type=application/x-www-form-urlencoded',\n 'type': 'POST',\n 'data': {'name': 'Chris'}\n })\n\n\nFor more background see https://github.com/tomchristie/django-rest-framework/pull/1731", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": null, "license": "LICENSE.txt", "maintainer": null, "maintainer_email": null, "name": "drf-url-content-type-override", "package_url": "https://pypi.org/project/drf-url-content-type-override/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/drf-url-content-type-override/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/drf-url-content-type-override/1.0.0/", "requires_dist": null, "requires_python": null, "summary": "The name says it all.", "version": "1.0.0" }, "last_serial": 3651974, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "942f87b09c96c188f8e8fc109507a70b", "sha256": "a95acba1690587180205454f5b3d8a15613cec64b51c8e507c3cbdc06d47f701" }, "downloads": -1, "filename": "drf-url-content-type-override-1.0.0.tar.gz", "has_sig": false, "md5_digest": "942f87b09c96c188f8e8fc109507a70b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3403, "upload_time": "2014-12-08T22:26:27", "url": "https://files.pythonhosted.org/packages/e3/3f/1045c170917032fda04cfdbb47a02749baf59b1714d4e9db6c13978b9f2c/drf-url-content-type-override-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "942f87b09c96c188f8e8fc109507a70b", "sha256": "a95acba1690587180205454f5b3d8a15613cec64b51c8e507c3cbdc06d47f701" }, "downloads": -1, "filename": "drf-url-content-type-override-1.0.0.tar.gz", "has_sig": false, "md5_digest": "942f87b09c96c188f8e8fc109507a70b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3403, "upload_time": "2014-12-08T22:26:27", "url": "https://files.pythonhosted.org/packages/e3/3f/1045c170917032fda04cfdbb47a02749baf59b1714d4e9db6c13978b9f2c/drf-url-content-type-override-1.0.0.tar.gz" } ] }