[PR #5238] [MERGED] docs: fix method match actual behavior #14121

Closed
opened 2026-04-13 09:19:24 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5238
Author: @bytaesu
Created: 10/11/2025
Status: Merged
Merged: 10/11/2025
Merged by: @Bekacru

Base: canaryHead: fix/docs-api-method


📝 Commits (3)

  • d6b7052 fix(docs): make api-method component match actual behavior
  • 29daaf5 docs: update contents to match api-method component changes
  • 31614d0 refactor: reduce confusion between query and body in api-method

📊 Changes

3 files changed (+177 additions, -109 deletions)

View changed files

📝 docs/components/api-method.tsx (+135 -57)
📝 docs/content/docs/plugins/admin.mdx (+40 -45)
📝 docs/content/docs/plugins/organization.mdx (+2 -7)

📄 Description


This PR updates the <APIMethod/> and modifies the related documentation content.

For GET requests, the Better Auth Client sends parameters using a query object. With the previous component, not providing a query object would cause a mismatch with the actual client behavior, and providing one would result in duplicate query objects on the server side. This PR resolves that issue.


Before:

1 2

After:

3 4

Summary by cubic

Fixes the component to match Better Auth Client behavior: GET requests now use query params automatically, preventing duplicate query objects and mismatched examples. Updated admin and organization docs to remove nested query wrappers and align with the new output.

  • Bug Fixes

    • Client: wraps params in query for GET or when forceAsQuery; uses body for POST or forceAsBody.
    • Server: selects query vs body using the same rules; no duplicate query objects.
    • Adds "server-only" comments for nested server-only props.
  • Refactors

    • Introduced helpers to decide query vs body and to build property lines.
    • Simplified indentation and unified comment placement.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/5238 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 10/11/2025 **Status:** ✅ Merged **Merged:** 10/11/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/docs-api-method` --- ### 📝 Commits (3) - [`d6b7052`](https://github.com/better-auth/better-auth/commit/d6b7052d3fb10970549a8835ebe14d55d8834ac7) fix(docs): make api-method component match actual behavior - [`29daaf5`](https://github.com/better-auth/better-auth/commit/29daaf5ace66ef452525d37a00e12a1867670276) docs: update contents to match api-method component changes - [`31614d0`](https://github.com/better-auth/better-auth/commit/31614d03977ff2948fff3ffa62868057107d1cab) refactor: reduce confusion between query and body in api-method ### 📊 Changes **3 files changed** (+177 additions, -109 deletions) <details> <summary>View changed files</summary> 📝 `docs/components/api-method.tsx` (+135 -57) 📝 `docs/content/docs/plugins/admin.mdx` (+40 -45) 📝 `docs/content/docs/plugins/organization.mdx` (+2 -7) </details> ### 📄 Description --- This PR updates the `<APIMethod/>` and modifies the related documentation content. For GET requests, the Better Auth Client sends parameters using a `query` object. With the previous component, not providing a query object would cause a mismatch with the actual client behavior, and providing one would result in duplicate query objects on the server side. This PR resolves that issue. --- ### Before: <img width="600" alt="1" src="https://github.com/user-attachments/assets/99e13539-1fc8-4497-97bc-f6154aaadd4a" /> <img width="600" alt="2" src="https://github.com/user-attachments/assets/ed61b6a2-770a-41e9-964b-b3deb05c3d88" /> ### After: <img width="600" alt="3" src="https://github.com/user-attachments/assets/e594e831-65b1-43d6-a812-301902088e8a" /> <img width="600" alt="4" src="https://github.com/user-attachments/assets/2036c6c9-c35c-4037-9057-0613c79efbc0" /> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes the <APIMethod/> component to match Better Auth Client behavior: GET requests now use query params automatically, preventing duplicate query objects and mismatched examples. Updated admin and organization docs to remove nested query wrappers and align with the new output. - **Bug Fixes** - Client: wraps params in query for GET or when forceAsQuery; uses body for POST or forceAsBody. - Server: selects query vs body using the same rules; no duplicate query objects. - Adds "server-only" comments for nested server-only props. - **Refactors** - Introduced helpers to decide query vs body and to build property lines. - Simplified indentation and unified comment placement. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 09:19:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#14121