mirror of
https://github.com/gradio-app/gradio.git
synced 2025-02-05 11:10:03 +08:00
Add credentials: include and Cookie header to prevent 401 error (#8600)
* Add credentials: include and Cookie header to prevent 401 error * FIx formatting * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
530f8a0b05
commit
7289c4b036
6
.changeset/flat-results-divide.md
Normal file
6
.changeset/flat-results-divide.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"@gradio/client": minor
|
||||||
|
"gradio": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
feat:Add credentials: include and Cookie header to prevent 401 error
|
@ -67,9 +67,16 @@ export class Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stream(url: URL): EventSource {
|
stream(url: URL): EventSource {
|
||||||
|
const headers = new Headers();
|
||||||
|
if (this && this.cookies) {
|
||||||
|
headers.append("Cookie", this.cookies);
|
||||||
|
}
|
||||||
|
|
||||||
this.abort_controller = new AbortController();
|
this.abort_controller = new AbortController();
|
||||||
|
|
||||||
this.stream_instance = readable_stream(url.toString(), {
|
this.stream_instance = readable_stream(url.toString(), {
|
||||||
|
credentials: "include",
|
||||||
|
headers: headers,
|
||||||
signal: this.abort_controller.signal
|
signal: this.abort_controller.signal
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user