Files
bun.sh/cmake
Claude Bot 23016b2a82 feat: Add Express/Rails-style req.query getter to BunRequest
Implements a new `req.query` getter that parses URL query parameters into nested objects and arrays, matching the behavior of Express.js and Ruby on Rails.

## Features
- Parses simple parameters: `?name=john&age=30` → `{ name: "john", age: "30" }`
- Supports nested objects: `?user[name]=alice` → `{ user: { name: "alice" } }`
- Supports arrays: `?ids[]=1&ids[]=2` → `{ ids: ["1", "2"] }`
- Supports indexed arrays: `?items[0]=a&items[1]=b` → `{ items: ["a", "b"] }`
- Handles complex nesting: `?users[0][name]=alice` → `{ users: [{ name: "alice" }] }`

## Implementation
- Extracted parsing logic to BunRequestParams.cpp for maintainability
- Added PropertyCallback getter to JSBunRequest
- Uses null prototype objects to prevent prototype pollution
- Ignores __proto__ keys for security
- Only available when using routes with Bun.serve()

## Testing
- Added comprehensive test suite with 20 test cases
- Exposed parseQueryParams in bun:internal-for-testing for unit testing
- Tests cover edge cases including sparse arrays, type conflicts, and security

This brings Bun's request handling closer to Express/Rails conventions, making it easier for developers to migrate existing applications.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 14:15:00 +00:00
..
2024-11-15 21:01:55 -08:00
2025-09-01 16:20:13 -07:00
2025-05-31 16:21:08 -07:00