Simply navigating to the URI in a browser (and thus submitting no queries) results in an empty list of responses here, which causes ValueError: max() arg is an empty sequence
This PR raises a BadRequest error if there are no queries in a batch, which produces a more sensible error message than what currently happens.
Having not looked at the GraphQL specs in-depth, it's debatable as to whether this behavior or returning an empty list of results with status=200 is the more desirable option. However, an empty list of queries is almost certainly an error on the client side and raising error in that event makes that situation easier to troubleshoot. Either outcome is better than the current situation, however.
With a view constructed as:
Simply navigating to the URI in a browser (and thus submitting no queries) results in an empty list of responses here, which causes
ValueError: max() arg is an empty sequence
This PR raises a BadRequest error if there are no queries in a batch, which produces a more sensible error message than what currently happens.
Having not looked at the GraphQL specs in-depth, it's debatable as to whether this behavior or returning an empty list of results with status=200 is the more desirable option. However, an empty list of queries is almost certainly an error on the client side and raising error in that event makes that situation easier to troubleshoot. Either outcome is better than the current situation, however.