Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
138bbfd9
Commit
138bbfd9
authored
Jul 05, 2023
by
StyleZhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix content-type
parent
3f22fdd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
base.ts
web/service/base.ts
+18
-2
No files found.
web/service/base.ts
View file @
138bbfd9
...
...
@@ -22,6 +22,16 @@ const baseOptions = {
redirect
:
'follow'
,
}
const
sseBaseOptions
=
{
method
:
'GET'
,
mode
:
'cors'
,
credentials
:
'include'
,
// always send cookies、HTTP Basic authentication.
headers
:
new
Headers
({
'Content-Type'
:
ContentType
.
json
,
}),
redirect
:
'follow'
,
}
export
type
IOnDataMoreInfo
=
{
conversationId
?:
string
taskId
?:
string
...
...
@@ -145,8 +155,14 @@ const baseFetch = (
options
.
headers
.
set
(
'Authorization'
,
`bearer
${
sharedToken
}
`
)
}
if
(
deleteContentType
)
if
(
deleteContentType
)
{
options
.
headers
.
delete
(
'Content-Type'
)
}
else
{
const
contentType
=
options
.
headers
.
get
(
'Content-Type'
)
if
(
!
contentType
)
options
.
headers
.
set
(
'Content-Type'
,
ContentType
.
json
)
}
const
urlPrefix
=
isPublicAPI
?
PUBLIC_API_PREFIX
:
API_PREFIX
let
urlWithPrefix
=
`
${
urlPrefix
}${
url
.
startsWith
(
'/'
)
?
url
:
`/
${
url
}
`
}
`
...
...
@@ -287,7 +303,7 @@ export const upload = (options: any): Promise<any> => {
export
const
ssePost
=
(
url
:
string
,
fetchOptions
:
any
,
{
isPublicAPI
=
false
,
onData
,
onCompleted
,
onError
,
getAbortController
}:
IOtherOptions
)
=>
{
const
abortController
=
new
AbortController
()
const
options
=
Object
.
assign
({},
b
aseOptions
,
{
const
options
=
Object
.
assign
({},
sseB
aseOptions
,
{
method
:
'POST'
,
signal
:
abortController
.
signal
,
},
fetchOptions
)
...
...
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