diff options
| author | Tom Christie | 2013-01-22 09:11:38 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-01-22 09:11:38 +0000 |
| commit | b7ab2aee46c718f683b19eefba1b48f233da40e4 (patch) | |
| tree | 1af09c7dbcc939c749d30adf25b14d232200f44f /docs/api-guide/parsers.md | |
| parent | 65b62d64ec54b528b62a1500b8f6ffe216d45c09 (diff) | |
| parent | e29ba356f054222893655901923811bd9675d4cc (diff) | |
| download | django-rest-framework-b7ab2aee46c718f683b19eefba1b48f233da40e4.tar.bz2 | |
Merge branch 'master' into unauthenticated_response
Conflicts:
docs/api-guide/authentication.md
Diffstat (limited to 'docs/api-guide/parsers.md')
| -rw-r--r-- | docs/api-guide/parsers.md | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/docs/api-guide/parsers.md b/docs/api-guide/parsers.md index 9356b420..0cd01639 100644 --- a/docs/api-guide/parsers.md +++ b/docs/api-guide/parsers.md @@ -14,6 +14,16 @@ REST framework includes a number of built in Parser classes, that allow you to a The set of valid parsers for a view is always defined as a list of classes. When either `request.DATA` or `request.FILES` is accessed, REST framework will examine the `Content-Type` header on the incoming request, and determine which parser to use to parse the request content. +--- + +**Note**: When developing client applications always remember to make sure you're setting the `Content-Type` header when sending data in an HTTP request. + +If you don't set the content type, most clients will default to using `'application/x-www-form-urlencoded'`, which may not be what you wanted. + +As an example, if you are sending `json` encoded data using jQuery with the [.ajax() method][jquery-ajax], you should make sure to include the `contentType: 'application/json'` setting. + +--- + ## Setting the parsers The default set of parsers may be set globally, using the `DEFAULT_PARSER_CLASSES` setting. For example, the following settings would allow requests with `YAML` content. @@ -167,8 +177,9 @@ The following third party packages are also available. ## MessagePack -[MessagePack][messagepack] is a fast, efficient binary serialization format. [Juan Riaza][juanriaza] maintains the `djangorestframework-msgpack` package which provides MessagePack renderer and parser support for REST framework. Documentation is [available here][djangorestframework-msgpack]. +[MessagePack][messagepack] is a fast, efficient binary serialization format. [Juan Riaza][juanriaza] maintains the [djangorestframework-msgpack][djangorestframework-msgpack] package which provides MessagePack renderer and parser support for REST framework. +[jquery-ajax]: http://api.jquery.com/jQuery.ajax/ [cite]: https://groups.google.com/d/topic/django-developers/dxI4qVzrBY4/discussion [messagepack]: https://github.com/juanriaza/django-rest-framework-msgpack [juanriaza]: https://github.com/juanriaza |
