Skip to content

Check for 406 status code when handling referrers API endpoint response - #2026

Merged
imjasonh merged 1 commit into
google:mainfrom
malancas:fetch-referrers-406-status-code-check
Oct 28, 2024
Merged

imjasonh merged 1 commit into
google:mainfrom
malancas:fetch-referrers-406-status-code-check

Conversation

@malancas

@malancas malancas commented Oct 17, 2024 •

Copy link
Copy Markdown
Contributor

While using the remote.Referrers function with the Artifactory registry, I found the function was unexpectedly failing. Digging into the error, I found the registry was returning a 406 instead of a 404 when the remote.Referrers function attempted to make a request to the referrers endpoint. Adding http.StatusNotAcceptable to the list of handled status codes in transport.CheckError fixed the problem for me.

This PR adds http.StatusNotAcceptable to the list of status codes handled by transport.CheckError. Since it is a 4XX error, remote.Referrers is able to fallback and try the manifests API endpoint.

I had filed #1962 asking about this change but realized the change is small enough a pull request might be easier.

@imjasonh
imjasonh enabled auto-merge (squash) October 28, 2024 17:13
@imjasonh
imjasonh merged commit a9a53a8 into google:main Oct 28, 2024
@malancas
malancas deleted the fetch-referrers-406-status-code-check branch March 24, 2025 14:49
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