Skip to content

feat(custom-routes): expose query params on request object#2938

Open
singhvishalkr wants to merge 1 commit into
slackapi:mainfrom
singhvishalkr:feat/custom-route-query-params
Open

feat(custom-routes): expose query params on request object#2938
singhvishalkr wants to merge 1 commit into
slackapi:mainfrom
singhvishalkr:feat/custom-route-query-params

Conversation

@singhvishalkr
Copy link
Copy Markdown

Summary

Exposes query parameters to custom route handlers via req.query, similar to how Express.js handles them. When a request like /greetings?name=you comes in, the handler can access req.query.name directly.

Changes

  • Added QueryDictionary type to ParamsIncomingMessage.ts
  • Added query property to ParamsIncomingMessage interface
  • Updated HTTPReceiver to parse query params and attach to request
  • Updated SocketModeReceiver to do the same
  • Exported QueryDictionary and ParamsIncomingMessage from index.ts

Example

customRoutes: [
  {
    path: '/greetings',
    method: ['GET'],
    handler: (req, res) => {
      res.writeHead(200);
      res.end(+""+Hello +""+${req.query?.name || 'World'}!);
    },
  },
]

Requesting /greetings?name=you returns "Hello you!"

For repeated keys like /test?tags=a&tags=b, req.query.tags becomes ['a', 'b'].

Fixes #2100

Adds a query property to ParamsIncomingMessage that contains parsed
query string parameters from the request URL. When a custom route
handler receives a request like /greetings?name=you, the handler can
access req.query.name.

For repeated keys (/test?tags=a&tags=b), the value becomes an array
instead of a single string.

Fixes slackapi#2100
@singhvishalkr singhvishalkr requested a review from a team as a code owner May 16, 2026 08:43
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 16, 2026

⚠️ No Changeset found

Latest commit: 82a8f65

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to get search params in custom routes

1 participant