ReactiveX / ReactiveX/rxjs

RxJs 7 setting X-Requested-With by default when RxJs 6 did not

Open
#6,827 5 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
31.7k
Forks
3k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

Reraise of https://github.com/ReactiveX/rxjs/issues/6663

The X-Requested-With header is still getting set in v7 with default parameters to an AJAX call where with RxJs 6 it did not, constituting a breaking change when using with a server that does not support preflight requests but does correctly return an Access-Control-Allow-Origin.

I've enhanced the reproductions to try show it more clearly in the codepen.

Expected behavior

Default parameter AJAX call to a non-same-origin endpoint which does not support Preflight but does return the correct allow headers to succeed. In other words - do not send a custom header in the request.

Reproduction code

Working:
6.6.7: https://codepen.io/Driskell/pen/yLovOxK

Not working:
7.4.0: https://codepen.io/Driskell/pen/MWvQymO
7.5.2: https://codepen.io/Driskell/pen/PoJyRaz
7.5.4: https://codepen.io/Driskell/pen/jOaGbwX
7.5.6: https://codepen.io/Driskell/pen/poVyyLo
8.0.0-alpha.4: https://codepen.io/Driskell/pen/NWMNNYV

Reproduction URL

No response

Version

7.5.2

Environment

No response

Additional context

No response

Contributor guide

Open the contributing guide

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 the linked CodePen reproductions and compare the default AJAX request behavior between RxJS 6.6.7 and the affected 7.x versions. Trace the AJAX request defaults that produce X-Requested-With, then verify that a cross-origin request without that custom header succeeds against the described server.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.