This repository was archived by the owner on May 21, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -103,8 +103,15 @@ func (r *ProxyResponseWriter) GetProxyResponse() (events.APIGatewayProxyResponse
103
103
isBase64 = true
104
104
}
105
105
106
+ proxyHeaders := make (map [string ]string )
107
+
108
+ for h := range r .headers {
109
+ proxyHeaders [h ] = r .headers .Get (h )
110
+ }
111
+
106
112
return events.APIGatewayProxyResponse {
107
113
StatusCode : r .status ,
114
+ Headers : proxyHeaders ,
108
115
MultiValueHeaders : http .Header (r .headers ),
109
116
Body : output ,
110
117
IsBase64Encoded : isBase64 ,
Original file line number Diff line number Diff line change @@ -153,8 +153,8 @@ var _ = Describe("ResponseWriter tests", func() {
153
153
proxyResponse , err := response .GetProxyResponse ()
154
154
Expect (err ).To (BeNil ())
155
155
156
- // Headers are not written to `Headers` field
157
- Expect (0 ).To (Equal (len (proxyResponse .Headers )))
156
+ // Headers are also written to `Headers` field
157
+ Expect (1 ).To (Equal (len (proxyResponse .Headers )))
158
158
Expect (1 ).To (Equal (len (proxyResponse .MultiValueHeaders ["Content-Type" ])))
159
159
Expect ("application/json" ).To (Equal (proxyResponse .MultiValueHeaders ["Content-Type" ][0 ]))
160
160
})
@@ -167,8 +167,8 @@ var _ = Describe("ResponseWriter tests", func() {
167
167
proxyResponse , err := response .GetProxyResponse ()
168
168
Expect (err ).To (BeNil ())
169
169
170
- // Headers are not written to `Headers` field
171
- Expect (0 ).To (Equal (len (proxyResponse .Headers )))
170
+ // Headers are also written to `Headers` field
171
+ Expect (2 ).To (Equal (len (proxyResponse .Headers )))
172
172
173
173
// There are two headers here because Content-Type is always written implicitly
174
174
Expect (2 ).To (Equal (len (proxyResponse .MultiValueHeaders ["Set-Cookie" ])))
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ require (
28
28
github.com/json-iterator/go v0.0.0-20180128142709-bca911dae073
29
29
github.com/kardianos/govendor v1.0.9 // indirect
30
30
github.com/kataras/golog v0.0.0-20190624001437-99c81de45f40 // indirect
31
- github.com/kataras/iris v11.1.1+incompatible // indirect
31
+ github.com/kataras/iris v11.1.1+incompatible
32
32
github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d // indirect
33
33
github.com/klauspost/compress v1.7.4 // indirect
34
34
github.com/klauspost/cpuid v1.2.1 // indirect
You can’t perform that action at this time.
0 commit comments