Spaces:
Runtime error
Runtime error
Update pkg/common/processBody.go
Browse files
pkg/common/processBody.go
CHANGED
@@ -20,14 +20,20 @@ func Do[T any](p ContextProcessor[T], conversation T) {
|
|
20 |
func CopyResponseHeaders(response *fhttp.Response, ctx *gin.Context) {
|
21 |
logger.Log.Debug("CopyResponseHeaders")
|
22 |
if response == nil {
|
23 |
-
ctx.JSON(400, gin.H{"error": "response is empty"})
|
24 |
logger.Log.Warning("response is empty")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
-
skipHeaders := map[string]bool{"Content-Encoding": true, "Content-Length": true, "transfer-encoding": true, "connection": true}
|
27 |
for name, values := range response.Header {
|
28 |
if !skipHeaders[name] {
|
29 |
for _, value := range values {
|
30 |
-
ctx.Writer.Header().
|
31 |
}
|
32 |
}
|
33 |
}
|
|
|
20 |
func CopyResponseHeaders(response *fhttp.Response, ctx *gin.Context) {
|
21 |
logger.Log.Debug("CopyResponseHeaders")
|
22 |
if response == nil {
|
|
|
23 |
logger.Log.Warning("response is empty")
|
24 |
+
ctx.JSON(400, gin.H{"error": "response is empty"})
|
25 |
+
return
|
26 |
+
}
|
27 |
+
skipHeaders := map[string]bool{
|
28 |
+
"content-encoding":true,
|
29 |
+
"content-length":true,
|
30 |
+
"transfer-encoding":true,
|
31 |
+
"connection":true,
|
32 |
}
|
|
|
33 |
for name, values := range response.Header {
|
34 |
if !skipHeaders[name] {
|
35 |
for _, value := range values {
|
36 |
+
ctx.Writer.Header().Add(name, value)
|
37 |
}
|
38 |
}
|
39 |
}
|