Skip to content

Commit

Permalink
fix: Undici parse header causing some headers are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Apr 9, 2024
1 parent 76a9ce4 commit 20734a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xmcl-runtime/network/dispatchers/NetworkAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class NetworkAgent extends Dispatcher {

dispatch(opts: Agent.DispatchOptions, handler: DispatchHandlers) {
const { host } = new URL(opts.origin as string)
const headers = opts.headers ? util.parseHeaders(opts.headers as any) : {}
const headers = opts.headers ? opts.headers instanceof Array ? util.parseHeaders(opts.headers as any) : opts.headers as any : {}
if (!headers['user-agent']) {
headers['user-agent'] = this.#userAgent
}
Expand Down

0 comments on commit 20734a0

Please sign in to comment.