Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9e592b56
authored
Jul 17, 2024
by
CalciumIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: try to fix panic #369
parent
5f137378
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
service/relay.go
+4
-3
No files found.
service/relay.go
View file @
9e592b56
...
@@ -5,6 +5,7 @@ import (
...
@@ -5,6 +5,7 @@ import (
"errors"
"errors"
"fmt"
"fmt"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
"net/http"
"one-api/common"
"one-api/common"
)
)
...
@@ -20,10 +21,10 @@ func StringData(c *gin.Context, str string) error {
...
@@ -20,10 +21,10 @@ func StringData(c *gin.Context, str string) error {
//str = strings.TrimPrefix(str, "data: ")
//str = strings.TrimPrefix(str, "data: ")
//str = strings.TrimSuffix(str, "\r")
//str = strings.TrimSuffix(str, "\r")
c
.
Render
(
-
1
,
common
.
CustomEvent
{
Data
:
"data: "
+
str
})
c
.
Render
(
-
1
,
common
.
CustomEvent
{
Data
:
"data: "
+
str
})
if
c
.
Writer
!=
nil
{
if
flusher
,
ok
:=
c
.
Writer
.
(
http
.
Flusher
);
ok
{
c
.
Writ
er
.
Flush
()
flush
er
.
Flush
()
}
else
{
}
else
{
return
errors
.
New
(
"
writer is nil
"
)
return
errors
.
New
(
"
streaming error: flusher not found
"
)
}
}
return
nil
return
nil
}
}
...
...
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