-
Notifications
You must be signed in to change notification settings - Fork 131
Fix compute ACL lookup call for status 204 #595
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 compute ACL lookup call for status 204 #595
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me, although I think we should communicate to the API owners that returning '204 No Content' when the requested IP is not present in the ACL is not terribly logical. '404 Not Found' would make a lot more sense.
…leaks (fastly#592) Co-authored-by: Sahib Yar <s.yar@centroidsol.com>
aa51300
to
b364f6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -33,6 +34,10 @@ func Lookup(c *fastly.Client, i *LookupInput) (*ComputeACLEntry, error) { | |||
} | |||
defer resp.Body.Close() | |||
|
|||
if resp.StatusCode != http.StatusOK { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case that no matching IP was found, the API will return a 204 No Content
. This is not an error condition, rather a lack of results.
Instead of returning an error here, consider alternatives to allow the caller to distinguish between an error (e.g. network timeout) and this case. One idea is to return (nil, nil)
.
This reverts commit 29832ac.
Fix for #594.
All Submissions:
Changes to Core Features: