Skip to content

Fix Accept header name and update API version to 2.20#163

Merged
aaronwolen merged 1 commit intomasterfrom
fix/accept-header
Feb 22, 2026
Merged

Fix Accept header name and update API version to 2.20#163
aaronwolen merged 1 commit intomasterfrom
fix/accept-header

Conversation

@aaronwolen
Copy link
Member

@aaronwolen aaronwolen commented Feb 22, 2026

Summary

  • Fixed incorrect HTTP header name in .build_client(): Accept-Header -> Accept. This bug meant API version pinning via the Accept header never actually worked.
  • Disabled version pinning by default. Since version pinning was never functional, enabling it now changes the API's response behavior and breaks download operations. The Accept header now requests JSON:API content without specifying a version, matching the package's historical behavior.
  • Changed version parameters from numeric to character to preserve versions like "2.20", which R silently truncates to 2.2 as a numeric value.
  • Hardcoded the OSF URL path prefix to "v2" instead of deriving it from the (now-optional) version parameter.

Notes

Explicitly pinning to a specific API version (e.g., v2.20) is left as a follow-up task. Attempting to pin to v2.20 caused all live download tests to fail with 404s from Waterbutler, likely because the version-pinned OSF API response format differs from the unpinned default in ways that affect file ID extraction. This needs investigation before version pinning can be safely enabled.

Test plan

  • Added unit tests for .build_client() verifying the Accept header behavior with and without version pinning
  • Full test suite passes locally (154 tests pass, 9 skipped for missing PAT)
  • CI passes with live download tests against test.osf.io

@aaronwolen aaronwolen marked this pull request as ready for review February 22, 2026 15:12
The Accept header was incorrectly set as `Accept-Header`, so API version
pinning never actually worked. Fixed the header name to `Accept`.

Since version pinning was never functional, enabling it now (with any
version) changes API behavior and breaks live download tests. For safety,
version pinning is now disabled by default -- the Accept header requests
JSON:API content without specifying a version, matching the package's
historical behavior.

Other changes:
- Changed version parameters from numeric to character to preserve
  versions like "2.20" (R truncates this to 2.2 as a numeric)
- Hardcoded the URL path prefix to "v2" instead of deriving it from the
  (now-optional) version parameter
@aaronwolen aaronwolen merged commit 965a9d4 into master Feb 22, 2026
5 checks passed
@aaronwolen aaronwolen deleted the fix/accept-header branch February 22, 2026 15:26
@aaronwolen aaronwolen mentioned this pull request Feb 22, 2026
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.

1 participant