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: inspect single field response to determine hit or miss #164

Merged
merged 1 commit into from
Feb 24, 2023

Conversation

pgautier404
Copy link
Contributor

No description provided.

field: rtype.fields[0],
body: rtype.items[0].CacheBody,
}, nil
switch rtype.responses[0].(type) {
Copy link
Member

Choose a reason for hiding this comment

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

should we check length make sure we have 1 field returned here before trying to grab 0 index?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The request is for exactly one field, so in this context it's safe as we know we got a hit. It's the same logic that is pulling the field and body properties out to populate the hit response.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah was just thinking be extra defensive not trust the API but I agree should not happen.

@pgautier404 pgautier404 merged commit ea4c507 into main Feb 24, 2023
@pgautier404 pgautier404 deleted the fix-dict-get-field-processing branch February 24, 2023 19:24
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.

2 participants