Skip to content

Commit a5fa6ca

Browse files
committed
fix: OPTIONS req err
1 parent c8be435 commit a5fa6ca

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

azure/proxy.go

+8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ import (
1818

1919
// Proxy Azure OpenAI
2020
func Proxy(c *gin.Context) {
21+
if c.Request.Method == http.MethodOptions {
22+
c.Header("Access-Control-Allow-Origin", "*")
23+
c.Header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
24+
c.Header("Access-Control-Allow-Headers", "Authorization")
25+
c.Status(200)
26+
return
27+
}
28+
2129
director := func(req *http.Request) {
2230
if req.Body == nil {
2331
util.SendError(c, errors.New("request body is empty"))

0 commit comments

Comments
 (0)