Skip to content

fix: make server JSON parsing and proxy handling robust#81

Open
ThanhNguyxn wants to merge 1 commit intozai-org:mainfrom
ThanhNguyxn:fix/server-json-proxy-handling
Open

fix: make server JSON parsing and proxy handling robust#81
ThanhNguyxn wants to merge 1 commit intozai-org:mainfrom
ThanhNguyxn:fix/server-json-proxy-handling

Conversation

@ThanhNguyxn
Copy link

Summary

  • replace strict Content-Type == application/json check with request.is_json and validate parsed payload shape
  • stop overriding http_proxy / https_proxy at module import time so network-constrained environments keep working
  • lazily import Pipeline and load_config to avoid heavy import-time dependency coupling in server module
  • add unit tests for JSON content-type with charset and proxy environment preservation

Why

The server currently rejects valid requests that send application/json; charset=utf-8, and it also clears proxy env vars globally on import. Together these behaviors can break real deployments (client compatibility + model/download connectivity).

Testing

  • python -m pytest glmocr/tests/test_unit.py -k \"server_accepts_json_content_type_with_charset or server_module_does_not_override_proxy_env\"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant