mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2026-05-10 00:52:32 +08:00
Merge 481c4b6772 into 7a8fc44f90
This commit is contained in:
commit
5513dc0a9c
@ -353,8 +353,12 @@ def _reject_simple_form_content_type(request):
|
|||||||
web.Response(status=400) when the request has a simple-form
|
web.Response(status=400) when the request has a simple-form
|
||||||
Content-Type that must be rejected. None when the request is allowed
|
Content-Type that must be rejected. None when the request is allowed
|
||||||
to proceed (no Content-Type, application/json, or any non-simple
|
to proceed (no Content-Type, application/json, or any non-simple
|
||||||
Content-Type).
|
Content-Type, or no request object — internal caller).
|
||||||
"""
|
"""
|
||||||
|
# Internal callers (e.g. legacy-UI batch flows) invoke route handlers
|
||||||
|
# directly with request=None; there is no Content-Type to gate.
|
||||||
|
if request is None:
|
||||||
|
return None
|
||||||
if request.content_type in _SIMPLE_FORM_CONTENT_TYPES:
|
if request.content_type in _SIMPLE_FORM_CONTENT_TYPES:
|
||||||
return web.Response(
|
return web.Response(
|
||||||
status=400,
|
status=400,
|
||||||
|
|||||||
@ -116,6 +116,12 @@ class ContentTypeRejectionTest(unittest.TestCase):
|
|||||||
r = self._post({"Content-Type": "application/json"})
|
r = self._post({"Content-Type": "application/json"})
|
||||||
self.assertEqual(r.status, 200)
|
self.assertEqual(r.status, 200)
|
||||||
|
|
||||||
|
def test_none_request_allowed(self):
|
||||||
|
# Internal callers (e.g. legacy-UI batch flows) invoke route handlers
|
||||||
|
# directly with request=None; helper must not raise AttributeError.
|
||||||
|
# Regression test for issue #2843.
|
||||||
|
self.assertIsNone(_reject_simple_form_content_type(None))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main(verbosity=2)
|
unittest.main(verbosity=2)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user