[PR #1865] [MERGED] fix(get-request-ip): improve header value retrieval for IP address extraction #4035

Closed
opened 2026-03-13 11:29:35 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/1865
Author: @ozgurozalp
Created: 3/18/2025
Status: Merged
Merged: 4/8/2025
Merged by: @Bekacru

Base: mainHead: feature-support-express-headers-for-getting-ip


📝 Commits (1)

  • 5b283d7 fix(get-request-ip): improve header value retrieval for IP address extraction

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/utils/get-request-ip.ts (+1 -1)

📄 Description

This pull request includes a small but important change to the getIp function in the packages/better-auth/src/utils/get-request-ip.ts file. The change ensures compatibility with different types of request objects by checking if the headers object has a get method before attempting to call it.


🔄 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/1865 **Author:** [@ozgurozalp](https://github.com/ozgurozalp) **Created:** 3/18/2025 **Status:** ✅ Merged **Merged:** 4/8/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `feature-support-express-headers-for-getting-ip` --- ### 📝 Commits (1) - [`5b283d7`](https://github.com/better-auth/better-auth/commit/5b283d775683f6db2e853a048a6efac7c4e1d0d7) fix(get-request-ip): improve header value retrieval for IP address extraction ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/utils/get-request-ip.ts` (+1 -1) </details> ### 📄 Description This pull request includes a small but important change to the `getIp` function in the `packages/better-auth/src/utils/get-request-ip.ts` file. The change ensures compatibility with different types of request objects by checking if the `headers` object has a `get` method before attempting to call it. * [`packages/better-auth/src/utils/get-request-ip.ts`](diffhunk://#diff-b386c725fba47b675a264ee1c46a6a31cf037534f1aae2f758cb7fbf1a18300bL29-R29): Modified the `getIp` function to use `headers.get(key)` if the `headers` object has a `get` method, otherwise it falls back to `headers[key]`. --- <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-03-13 11:29:35 -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#4035