feat: optional token echo in sse endpoint
This commit is contained in:
11
main.go
11
main.go
@@ -323,11 +323,16 @@ func (s *TaoServer) SSEHandler(w http.ResponseWriter, r *http.Request) {
|
||||
client = generateClientID()
|
||||
}
|
||||
|
||||
if queryToken != "" {
|
||||
endpointToken := queryToken
|
||||
if endpointToken == "" && getEnvBool("TAO_ENDPOINT_TOKEN_ECHO", false) {
|
||||
endpointToken = token
|
||||
}
|
||||
|
||||
if endpointToken != "" {
|
||||
if strings.Contains(endpoint, "?") {
|
||||
endpoint = endpoint + "&token=" + queryToken
|
||||
endpoint = endpoint + "&token=" + endpointToken
|
||||
} else {
|
||||
endpoint = endpoint + "?token=" + queryToken
|
||||
endpoint = endpoint + "?token=" + endpointToken
|
||||
}
|
||||
}
|
||||
if client != "" {
|
||||
|
||||
Reference in New Issue
Block a user