Skip to content

Commit

Permalink
add X-Requested-With header to fetch() requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jkissel committed Jul 11, 2024
1 parent fcbc102 commit 58f9b96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
### Fixed
- Make Cadenza return an error instead of showing an error page.

## 2.10.0 - 2024-06-11
### Added
Expand Down
8 changes: 7 additions & 1 deletion src/cadenza.js
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,13 @@ export class CadenzaClient {
) {
const url = this.#createUrl(path, params);
this.#log('Fetch', url.toString());
const res = await fetch(url, { signal });
const res = await fetch(url, {
signal,
headers: {
// Make Cadenza return an error instead of showing an error page.
'X-Requested-With': 'XMLHttpRequest'
}
});
if (!res.ok) {
const errorType =
{
Expand Down

0 comments on commit 58f9b96

Please sign in to comment.