Skip to content

Commit

Permalink
fix: OPTIONS req err
Browse files Browse the repository at this point in the history
  • Loading branch information
stulzq committed Apr 25, 2023
1 parent c8be435 commit a5fa6ca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions azure/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ import (

// Proxy Azure OpenAI
func Proxy(c *gin.Context) {
if c.Request.Method == http.MethodOptions {
c.Header("Access-Control-Allow-Origin", "*")
c.Header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
c.Header("Access-Control-Allow-Headers", "Authorization")
c.Status(200)
return
}

director := func(req *http.Request) {
if req.Body == nil {
util.SendError(c, errors.New("request body is empty"))
Expand Down

0 comments on commit a5fa6ca

Please sign in to comment.