[Django]-How to send data as key โ€“ value pairs instead of string via POST using XHR

5๐Ÿ‘

โœ…

you could either:

  • fiddle with the client to send data instead of json
  • use json.loads(request.raw_post_data).get('name', None) (django < 1.4)
  • use json.loads(request.body).get('name', None) (django >= 1.4)

The Angular documentation talks about transforming requests and responses

To override these transformation locally, specify transform functions as transformRequest and/or transformResponse properties of the config object. To globally override the default transforms, override the $httpProvider.defaults.transformRequest and $httpProvider.defaults.transformResponse properties of the $httpProvider.

you can find an example here as was previously pointed at.

๐Ÿ‘คdnozay

Leave a comment