Skip to content

feat: add variable interpolation support for WebSocket requests#6064

Merged
sid-bruno merged 8 commits intousebruno:mainfrom
chirag-bruno:feature/ws-variable-interpolation
Nov 17, 2025
Merged

feat: add variable interpolation support for WebSocket requests#6064
sid-bruno merged 8 commits intousebruno:mainfrom
chirag-bruno:feature/ws-variable-interpolation

Conversation

@chirag-bruno
Copy link
Collaborator

Description

  • Add WebSocket body interpolation in interpolateVars function
  • Interpolate URL, headers, and all messages in request.body.ws array with full variable context
  • Refactor sendWsRequest to use main process preparation (removes duplication)
  • Add mode property to wsRequest object for proper request type detection
  • Ensure consistent variable precedence matching HTTP/gRPC requests
  • Centralise all interpolation logic in main process via prepareWsRequest

This PR addresses this JIRA ticket.

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

- Add WebSocket body interpolation in interpolateVars function
- Interpolate URL, headers, and all messages in request.body.ws array with full variable context
- Refactor sendWsRequest to use main process preparation (removes duplication)
- Add mode property to wsRequest object for proper request type detection
- Ensure consistent variable precedence matching HTTP/gRPC requests
- Centralize all interpolation logic in main process via prepareWsRequest
@sid-bruno
Copy link
Collaborator

Add tests in playwright for this as well

- Add tests for URL interpolation (wss://echo.{{url}}.org)
- Add tests for message content interpolation ({"test": "{{data}}"})
- Update test fixtures to use wss://echo.websocket.org echo server
- Add WEBSOCKET_FLOWS.md documentation
- Refactor queueWsMessage to handle variable interpolation in main process
@sid-bruno sid-bruno merged commit 8ec1925 into usebruno:main Nov 17, 2025
7 checks passed
@chirag-bruno chirag-bruno mentioned this pull request Nov 24, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants