Explorar el Código

Export headers from /_log when requesting YAML

This got lost in the refactoring, now it's back.
Lu Stadler %!s(int64=7) %!d(string=hace) años
padre
commit
9d47df3863
Se han modificado 1 ficheros con 11 adiciones y 4 borrados
  1. 11 4
      go/fake-http/fake-http.go

+ 11 - 4
go/fake-http/fake-http.go

@ -270,11 +270,18 @@ type LogEntry struct {
270 270
271 271
// AsResponse returns a Response representation of the entry.
272 272
func (e LogEntry) AsResponse() Response {
273
	headers := make([]Header, 0, len(e.response.Header))
274
	for name, vals := range e.response.Header {
275
		for _, val := range vals {
276
			headers = append(headers, Header{Name: name, Value: val})
277
		}
278
	}
273 279
	return Response{
274
		Method: e.request.Method,
275
		Path:   e.request.URL.Path,
276
		Status: e.response.StatusCode,
277
		Body:   e.responseBody.String(),
280
		Method:  e.request.Method,
281
		Path:    e.request.URL.Path,
282
		Status:  e.response.StatusCode,
283
		Headers: headers,
284
		Body:    e.responseBody.String(),
278 285
	}
279 286
}
280 287