Description
When editing a gateway in the admin UI and clearing the passthrough_headers field (removing all values), the field retains its previous value. There is no way to clear it once set.
Steps to Reproduce
- Create or edit a gateway with
passthrough_headers set (e.g. ["Authorization", "X-Custom"])
- Edit the gateway in the admin UI
- Clear the
passthrough_headers field (remove all text)
- Save the gateway
- Observe: the field still contains the previous values
Root Cause
In admin.py, str(form.get("passthrough_headers")) converts an empty/None form value to the Python string "None", which is truthy. The subsequent parsing logic treats it as valid input rather than a cleared field.
Additionally, in gateway_service.py, when an empty list [] is passed (meaning "user cleared the field"), it is stored as-is in the DB rather than being converted to None (the canonical "no passthrough headers" value).
Expected Behavior
Clearing the passthrough_headers field in the edit form should remove all passthrough headers from the gateway (store None in DB).
Environment
- Version: main (HEAD)
- Component: Admin UI + Gateway Service
Description
When editing a gateway in the admin UI and clearing the
passthrough_headersfield (removing all values), the field retains its previous value. There is no way to clear it once set.Steps to Reproduce
passthrough_headersset (e.g.["Authorization", "X-Custom"])passthrough_headersfield (remove all text)Root Cause
In
admin.py,str(form.get("passthrough_headers"))converts an empty/None form value to the Python string"None", which is truthy. The subsequent parsing logic treats it as valid input rather than a cleared field.Additionally, in
gateway_service.py, when an empty list[]is passed (meaning "user cleared the field"), it is stored as-is in the DB rather than being converted toNone(the canonical "no passthrough headers" value).Expected Behavior
Clearing the
passthrough_headersfield in the edit form should remove all passthrough headers from the gateway (storeNonein DB).Environment