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
OpenDAS
ollama
Commits
3dcbcd36
Unverified
Commit
3dcbcd36
authored
Feb 07, 2024
by
Michael Yang
Committed by
GitHub
Feb 07, 2024
Browse files
Merge pull request #2394 from ollama/mxyng/fix-error-response
parents
b9229ffc
e805ac1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
server/auth.go
server/auth.go
+8
-2
No files found.
server/auth.go
View file @
3dcbcd36
...
...
@@ -111,8 +111,14 @@ func getAuthToken(ctx context.Context, redirData AuthRedirect) (string, error) {
defer
resp
.
Body
.
Close
()
if
resp
.
StatusCode
>=
http
.
StatusBadRequest
{
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
return
""
,
fmt
.
Errorf
(
"on pull registry responded with code %d: %s"
,
resp
.
StatusCode
,
body
)
responseBody
,
err
:=
io
.
ReadAll
(
resp
.
Body
)
if
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"%d: %v"
,
resp
.
StatusCode
,
err
)
}
else
if
len
(
responseBody
)
>
0
{
return
""
,
fmt
.
Errorf
(
"%d: %s"
,
resp
.
StatusCode
,
responseBody
)
}
return
""
,
fmt
.
Errorf
(
"%s"
,
resp
.
Status
)
}
respBody
,
err
:=
io
.
ReadAll
(
resp
.
Body
)
...
...
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