Просмотр исходного кода

Fix Content-Length for prettified responses

Lu Stadler лет назад: 7
Родитель
Сommit
b293d807bd
1 измененных файлов с 1 добавлено и 0 удалено
  1. 1 0
      go/fake-http/fake-http.go

+ 1 - 0
go/fake-http/fake-http.go

69
			if err != nil {
69
			if err != nil {
70
				log.Printf("Error: Prettyfying JSON: %s", err)
70
				log.Printf("Error: Prettyfying JSON: %s", err)
71
			} else {
71
			} else {
72
				resp.Header.Set("Content-Length", fmt.Sprintf("%d", len(pretty)))
72
				resp.Body = ioutil.NopCloser(bytes.NewReader(pretty))
73
				resp.Body = ioutil.NopCloser(bytes.NewReader(pretty))
73
			}
74
			}
74
		}
75
		}