Closed fformica closed 7 months ago
I tested with the following (on prod0) that we can now update tags independently:
client.Records.Delete("fformica.com", "my.test.a.fformica.com", "A")
record := dns.NewRecord("fformica.com", "my.test.a.fformica.com", "A", map[string]string{"one": "two"}, nil)
resp, err := client.Records.Create(record)
require.NoError(t, err)
require.Equal(t, 200, resp.StatusCode)
record, resp, err = client.Records.Get("fformica.com", "my.test.a.fformica.com", "A")
require.NoError(t, err)
require.Equal(t, 200, resp.StatusCode)
require.Equal(t, map[string]string{"one": "two"}, record.Tags)
record.Tags = map[string]string{"three": "four"}
resp, err = client.Records.Update(record)
require.NoError(t, err)
require.Equal(t, 200, resp.StatusCode)
record, resp, err = client.Records.Get("fformica.com", "my.test.a.fformica.com", "A")
require.NoError(t, err)
require.Equal(t, 200, resp.StatusCode)
require.Equal(t, map[string]string{"three": "four"}, record.Tags)
This PR sets
tags
andblocked_tags
asomitempty
, which fixes the issue in #224 on the client side: however, this has a side effect of not allowing to empty out existing tags in an update, because an empty array is omitted just like null is.