RocketChat / RocketChat/Rocket.Chat.js.SDK

`customHeaders` is a module global, so two Clients in one process can't differ

Open
#282 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ready-for-agent
Dominant language
TypeScript
Stars
146
Forks
99
Avg merge
7h 59m
Merged PRs (30d)
17

Description

Where: lib/drivers/ddp.ts (Socket construction), lib/settings.ts.

Problem

The Socket reads settings.customHeaders at construction, and lib/settings.ts reads process.env at import time. So custom headers are not part of the options at all — two Clients in one process cannot have different ones, and a consumer cannot set them per connection.

The test suite has to spy on the module to exercise them, and carries an extra test asserting the reset did not leak into other specs.

Fix

customHeaders joins the resolved config, defaulting to settings.customHeaders so existing behaviour is unchanged. Removes a hidden dependency from the transport seam, and makes per-Client headers possible without new public surface.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Socket construction in lib/drivers/ddp.ts and configuration resolution in lib/settings.ts, then inspect the existing tests that spy on the settings module. Verify that customHeaders can differ between Clients while the existing settings.customHeaders default remains unchanged, and run the relevant test suite to confirm no reset leaks between specs.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.