summaryrefslogtreecommitdiff
path: root/django/test
diff options
context:
space:
mode:
Diffstat (limited to 'django/test')
-rw-r--r--django/test/client.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/django/test/client.py b/django/test/client.py
index d14ba43792..07641b7e65 100644
--- a/django/test/client.py
+++ b/django/test/client.py
@@ -192,7 +192,12 @@ def encode_multipart(boundary, data):
# file, or a *list* of form values and/or files. Remember that HTTP field
# names can be duplicated!
for (key, value) in data.items():
- if is_file(value):
+ if value is None:
+ raise TypeError(
+ 'Cannot encode None as POST data. Did you mean to pass an '
+ 'empty string or omit the value?'
+ )
+ elif is_file(value):
lines.extend(encode_file(boundary, key, value))
elif not isinstance(value, str) and is_iterable(value):
for item in value: