fix(automation_tokens): Fix decodeBodyMap for string to time.Time #619
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All Submissions:
New Feature Submissions:
Changes to Core Features:
User Impact
Resolves #575
This change resolves the issue in decodeBodyMap when attempting to parse strings as
time.Time
when the returned value is an empty string.It appears the API changed its default behaviour since support for
AutomationTokens
was added, most notably:time.Time
(0001-01-01T00:00:00Z
) forExpiresAt
which resulted in a token with no expiry ("expires_at":null
)"expires_at":null
or omit it from the request.time.Time
forlast_used_at
(can be seen in the diff for the test fixtures) which decoded fine but the default response has changed to an empty string which now fails to parse."expires_at":""
which will result in the same error being seen by"last_used_at":""
in the linked issue.Are there any considerations that need to be addressed for release?
This should be low risk as the change only impacts the decoding of objects that have a
time.Time
field, and only changes the behaviour if the endpoint returned an empty string for that field - meaning the endpoint wouldn't currently work without this change.