Skip to content

Commit

Permalink
allow arbitrary headers
Browse files Browse the repository at this point in the history
To match previous behavior.
  • Loading branch information
ChlodAlejandro committed Mar 1, 2024
1 parent b310cad commit 51b2eb8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/WikimediaStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,17 @@ export class WikimediaStream extends EventEmitter {
// Send a generic user agent if one wasn't provided.
headers[ 'User-Agent' ] = WikimediaStream.defaultUserAgent;
}

for ( const header in userHeaders ) {
if (
header === 'last-event-id' ||
header === 'user-agent' ||
header === 'api-user-agent'
) {
continue;
}
headers[ header ] = options.headers[ header ];
}
}

const url = new URL( `https://stream.wikimedia.org/v2/stream/${this.streams.join( ',' )}` );
Expand Down Expand Up @@ -564,7 +575,6 @@ export class WikimediaStream extends EventEmitter {
}

/**
*
* @param options
*/
attachEventListeners( options: WikimediaStreamOptions ) {
Expand Down

0 comments on commit 51b2eb8

Please sign in to comment.