Skip to content

Fix REST POST mutations and refresh query IDs (March 2026) - #1

Open
jwelten wants to merge 1 commit into
MichielMAnalytics:mainfrom
jwelten:fix/rest-post-headers-and-query-ids
Open

jwelten wants to merge 1 commit into
MichielMAnalytics:mainfrom
jwelten:fix/rest-post-headers-and-query-ids

Conversation

@jwelten

@jwelten jwelten commented Mar 24, 2026 •

Copy link
Copy Markdown

Summary

  • Fix Content-Type header casing in apiPost() — getJsonHeadersAsync() sets lowercase content-type: application/json, but apiPost() was setting Content-Type (title case) to override it. JavaScript objects are case-sensitive, so both headers were sent simultaneously, causing Twitter to reject all REST POST requests (follow, unfollow, tweet, like, retweet, bookmark, etc.) with HTTP 403.
  • Update x-client-transaction-id from 0.1.9 → 0.2.0 to fix transaction ID generation (KEY_BYTE indices error)
  • Refresh all GraphQL query IDs scraped from Twitter's current JS bundle (main.cbf7085a.js, March 2026) — 20+ stale IDs updated
  • Improve follow() resilience — don't short-circuit on REST error code 108 (Twitter now returns this as a generic rejection for deprecated auth patterns); fall through to GraphQL fallback instead. Added standard API parameters to match web client behavior.

What was broken

All REST POST mutations (follow, unfollow, tweet, reply, like, retweet, bookmark) were silently failing due to the duplicate Content-Type/content-type header. GraphQL reads also failed due to stale query IDs.

Test plan

  • bird whoami — auth check
  • bird home — home timeline
  • bird search "AI agents" — search
  • bird user-tweets @sama — user tweets
  • bird about @drfeifei — user lookup
  • bird following — following list
  • bird trending — trending topics
  • bird follow @shanselman — follow user
  • bird unfollow @techgirl1908 — unfollow user
  • Re-follow after unfollow to confirm round-trip

🤖 Generated with Claude Code

- Fix Content-Type header casing in apiPost(): `getJsonHeadersAsync` sets
  lowercase `content-type`, but apiPost was setting `Content-Type` (title case),
  resulting in duplicate headers that caused Twitter to reject all REST POST
  requests (follow, unfollow, tweet, like, etc.) with 403.

- Update x-client-transaction-id from 0.1.9 to 0.2.0 to fix transaction ID
  generation (KEY_BYTE indices error).

- Refresh all GraphQL query IDs scraped from Twitter's current JS bundle
  (main.cbf7085a.js, March 2026).

- Improve follow() resilience: don't throw on REST error code 108 (which
  Twitter now returns as a generic rejection), fall through to GraphQL
  fallback instead. Add standard Twitter API parameters to follow request
  body to match web client behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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