Skip to content

Omit empty cursor parameter in Compute ACL's ListEntries requests#778

Merged
philippschulte merged 1 commit intofastly:mainfrom
philippschulte:pschulte/fix-compute-acl-list-entries-empty-cursor
Jan 21, 2026
Merged

Omit empty cursor parameter in Compute ACL's ListEntries requests#778
philippschulte merged 1 commit intofastly:mainfrom
philippschulte:pschulte/fix-compute-acl-list-entries-empty-cursor

Conversation

@philippschulte
Copy link
Member

Change summary

This PR fixes an issue where the go-fastly client would send a ?cursor= query parameter in ListEntries requests when no cursor value was provided by the user.

Recent upstream API behavior now rejects this with a 400 Bad Request: invalid cursor error. Previously, this was either tolerated by the API or untested — but we cannot definitively prove whether the behavior changed or was always like this.

Root cause

  • The CLI (which uses go-fastly) sets Cursor = "" by default when the --cursor flag is not provided, due to Go’s default zero value for strings.
  • In go-fastly, the ListEntries function would include all non-nil values in the query parameters — so cursor="" resulted in a request like:
    GET /resources/acls/<id>/entries?cursor=
    
  • This caused the API to return a 400 error, even though cursor is documented as optional.

Fix

We now explicitly omit the cursor parameter from the request if:

  • it is nil, or
  • it is an empty string ("")

This matches the intended behavior and prevents accidental inclusion of invalid cursor values.

Test coverage

  • A regression test has been added to the main integration test (TestClient_ComputeACL) to verify that calling ListEntries with cursor="" does not result in an error.
  • Previously, we had no test case that passed an explicit empty cursor, which allowed this issue to go undetected.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

@philippschulte philippschulte requested a review from a team as a code owner January 21, 2026 14:16
@philippschulte philippschulte merged commit 2976e6e into fastly:main Jan 21, 2026
9 checks passed
@philippschulte philippschulte deleted the pschulte/fix-compute-acl-list-entries-empty-cursor branch January 21, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants