Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Unmarshal response #9

Merged
merged 5 commits into from
Sep 30, 2024
Merged

fix: Unmarshal response #9

merged 5 commits into from
Sep 30, 2024

Conversation

mgaeta
Copy link
Contributor

@mgaeta mgaeta commented Sep 25, 2024

Description

We're getting an error when creating an API token:

init-env-config: failed to initialize connector: jamf-connector: failed to get token: failed to unmarshal json response: json: Unmarshal(non-pointer jamf.TokenResponse).

Maybe the problem is that target isn't a pointer?

@mgaeta mgaeta requested review from ggreer and a team September 25, 2024 17:46
@@ -76,7 +76,7 @@ func (c *Client) CreateBearerToken(
request.SetBasicAuth(username, password)

var target TokenResponse
response, err := c.wrapper.Do(request, uhttp.WithJSONResponse(target))
response, err := c.wrapper.Do(request, uhttp.WithJSONResponse(&target))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be the problem?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be the problem?

AFAIK, not the case, target wouldn't be nil when the pointer reference is being asked, so I don't think this would cause a panic.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, nvm my message lol.

@ggreer
Copy link
Contributor

ggreer commented Sep 25, 2024

Fix the linter errors and merge away.

@mgaeta mgaeta merged commit a58a9bb into main Sep 30, 2024
2 checks passed
@ggreer ggreer deleted the marcos/fix/unmarshal-token branch October 10, 2024 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants