MCPcopy
hub / github.com/django/django / _encode_data

Method _encode_data

django/test/client.py:438–448  ·  view source on GitHub ↗
(self, data, content_type)

Source from the content-addressed store, hash-verified

436 return WSGIRequest(self._base_environ(**request))
437
438 def _encode_data(self, data, content_type):
439 if content_type is MULTIPART_CONTENT:
440 return encode_multipart(BOUNDARY, data)
441 else:
442 # Encode the content so that the byte representation is correct.
443 match = CONTENT_TYPE_RE.match(content_type)
444 if match:
445 charset = match[1]
446 else:
447 charset = settings.DEFAULT_CHARSET
448 return force_bytes(data, encoding=charset)
449
450 def _encode_json(self, data, content_type):
451 """

Callers 1

postMethod · 0.95

Calls 3

force_bytesFunction · 0.90
encode_multipartFunction · 0.85
matchMethod · 0.45

Tested by

no test coverage detected