Closed
Description
When trying to run get_comments()
via something like
l_items[216].get_comments().execute_query()
one obtains the error
ClientRequestException: ('-1, Microsoft.SharePoint.Client.InvalidClientQueryException', "A node of type 'EndOfInput' was read from the JSON reader when trying to read the start of an entry. A 'StartObject' node was expected.", "400 Client Error: Bad Request for url: https://url/_api/Web/lists/GetByTitle('ListTitle')/items(216)/GetComments()")
is produced.
The issue seems to be a wrong request.method
that is ultimately being used in execute_query()
. The following patchwork fix resolves the issue, though it is clearly not tackling the root cause:
def execute_query(self, query):
# type: (ClientQuery) -> None
"""Submits a pending request to the server"""
try:
request = self.build_request(query)
# fix request.method on the fly
if "getcomments" in request.url.lower():
request.method = "GET"
response = self.execute_request_direct(request)
self.process_response(response, query)
self.afterExecute.notify(response)
except HTTPError as e:
raise ClientRequestException(*e.args, response=e.response)