🐛 fix(PostRequest.py): add validation for document parameter to only accept Document or list of Documents to prevent errors
This commit is contained in:
parent
4efe06e440
commit
0d53db1653
1 changed files with 3 additions and 1 deletions
|
|
@ -63,8 +63,10 @@ class PostRequest(CustomComponent):
|
||||||
if headers is None:
|
if headers is None:
|
||||||
headers = {}
|
headers = {}
|
||||||
|
|
||||||
if not isinstance(document, list):
|
if not isinstance(document, list) and isinstance(document, Document):
|
||||||
document = [document]
|
document = [document]
|
||||||
|
else:
|
||||||
|
raise ValueError("document must be a Document or a list of Documents")
|
||||||
|
|
||||||
with requests.Session() as session:
|
with requests.Session() as session:
|
||||||
documents = [
|
documents = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue