Context
Both CreateDestination and DestinationSettings in the portal have special-case logic to handle empty custom_headers for webhook destinations:
if (
type.type === "webhook" &&
key === "custom_headers" &&
(configValue === "{}" || configValue === "")
) {
configValue = "";
}
This feels off — the portal shouldn't need to call out a specific field for a specific destination type.
The question
In destwebhook.go, resolveConfig rejects an empty map ("{}") for custom_headers:
if len(config.CustomHeaders) == 0 {
return nil, nil, destregistry.NewErrDestinationValidation(...)
}
But an empty map is semantically identical to the field being absent — both mean "no custom headers." The backend already handles absent/empty string by skipping the block entirely. Why not do the same for {}?
If the backend treated {} the same as absent, we could remove the workarounds in the portal entirely and the KeyValueMapField component wouldn't need any special empty-state handling.
Ref #707, #708, #674
Context
Both
CreateDestinationandDestinationSettingsin the portal have special-case logic to handle emptycustom_headersfor webhook destinations:This feels off — the portal shouldn't need to call out a specific field for a specific destination type.
The question
In
destwebhook.go,resolveConfigrejects an empty map ("{}") forcustom_headers:But an empty map is semantically identical to the field being absent — both mean "no custom headers." The backend already handles absent/empty string by skipping the block entirely. Why not do the same for
{}?If the backend treated
{}the same as absent, we could remove the workarounds in the portal entirely and theKeyValueMapFieldcomponent wouldn't need any special empty-state handling.Ref #707, #708, #674