Skip to content

Can't disable subscription tracking #68

@joaolsilva

Description

@joaolsilva

Issue Summary

The API won't allow disabling subscription tracking because the Enable parameter won't be sent when it's false, returning the error: "The subscription_tracking enable parameter is required."

Steps to Reproduce

Send an email with the following options:

trackingSettings := mail.NewTrackingSettings()
subscriptionTrackingSetting := mail.NewSubscriptionTrackingSetting()
subscriptionTrackingSetting.SetEnable(false)
trackingSettings.SetSubscriptionTracking(subscriptionTrackingSetting)
m.SetTrackingSettings(trackingSettings)

The following error will be returned:

&{400 {"errors":[{"message":"The subscription_tracking enable parameter is required.","field":"tracking_settings.subscription_tracking.enable","help":"http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.tracking_settings.subscription_tracking.enable"}]} map[X-Frame-Options:[DENY] Server:[nginx] Date:[Fri, 01 Jul 2016 12:09:18 GMT] Content-Type:[application/json] Content-Length:[270] Connection:[keep-alive]]}

This happens because the Enabled field of the SubscriptionTrackingSetting struct has the JSON options json:"enable,omitempty" therefore false is not encoded. See http://stackoverflow.com/questions/37756236/json-golang-boolean-omitempty for more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions