Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
a6aa46dd
".github/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "48e36353d8cbf0322ec1ad0684b95d11f70af2de"
Commit
a6aa46dd
authored
Feb 08, 2024
by
Ying Sheng
Browse files
minor
parent
405f26b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
python/sglang/utils.py
python/sglang/utils.py
+4
-1
No files found.
python/sglang/utils.py
View file @
a6aa46dd
...
@@ -91,6 +91,8 @@ class HttpResponse:
...
@@ -91,6 +91,8 @@ class HttpResponse:
def
http_request
(
url
,
json
=
None
,
stream
=
False
,
auth_token
=
None
):
def
http_request
(
url
,
json
=
None
,
stream
=
False
,
auth_token
=
None
):
"""A faster version of requests.post with low-level urllib API."""
"""A faster version of requests.post with low-level urllib API."""
if
stream
:
if
stream
:
if
auth_token
is
None
:
return
requests
.
post
(
url
,
json
=
json
,
stream
=
True
)
headers
=
{
headers
=
{
"Content-Type"
:
"application/json"
,
"Content-Type"
:
"application/json"
,
"Authentication"
:
f
"Bearer
{
auth_token
}
"
"Authentication"
:
f
"Bearer
{
auth_token
}
"
...
@@ -99,7 +101,8 @@ def http_request(url, json=None, stream=False, auth_token=None):
...
@@ -99,7 +101,8 @@ def http_request(url, json=None, stream=False, auth_token=None):
else
:
else
:
req
=
urllib
.
request
.
Request
(
url
)
req
=
urllib
.
request
.
Request
(
url
)
req
.
add_header
(
"Content-Type"
,
"application/json; charset=utf-8"
)
req
.
add_header
(
"Content-Type"
,
"application/json; charset=utf-8"
)
req
.
add_header
(
"Authentication"
,
f
"Bearer
{
auth_token
}
"
)
if
auth_token
is
not
None
:
req
.
add_header
(
"Authentication"
,
f
"Bearer
{
auth_token
}
"
)
if
json
is
None
:
if
json
is
None
:
data
=
None
data
=
None
else
:
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment