diff options
| author | 2025-01-27 11:06:46 +0000 | |
|---|---|---|
| committer | 2025-01-27 11:06:46 +0000 | |
| commit | 5c96702cb5d9461b35c232858a3c91ab699dec7d (patch) | |
| tree | d11da1c2140aadb19c5888c545af81ab3d9f6081 /vendor/github.com/gin-contrib/sse/sse-encoder.go | |
| parent | [chore] Allow suppressing trusted-proxies warning by disabling rate limiting ... (diff) | |
| download | gotosocial-5c96702cb5d9461b35c232858a3c91ab699dec7d.tar.xz | |
[chore]: Bump github.com/gin-contrib/gzip from 1.1.0 to 1.2.2 (#3693)
Bumps [github.com/gin-contrib/gzip](https://github.com/gin-contrib/gzip) from 1.1.0 to 1.2.2.
- [Release notes](https://github.com/gin-contrib/gzip/releases)
- [Changelog](https://github.com/gin-contrib/gzip/blob/master/.goreleaser.yaml)
- [Commits](https://github.com/gin-contrib/gzip/compare/v1.1.0...v1.2.2)
---
updated-dependencies:
- dependency-name: github.com/gin-contrib/gzip
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/gin-contrib/sse/sse-encoder.go')
| -rw-r--r-- | vendor/github.com/gin-contrib/sse/sse-encoder.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/vendor/github.com/gin-contrib/sse/sse-encoder.go b/vendor/github.com/gin-contrib/sse/sse-encoder.go index f9c808750..0d26c82f0 100644 --- a/vendor/github.com/gin-contrib/sse/sse-encoder.go +++ b/vendor/github.com/gin-contrib/sse/sse-encoder.go @@ -18,7 +18,7 @@ import ( // W3C Working Draft 29 October 2009 // http://www.w3.org/TR/2009/WD-eventsource-20091029/ -const ContentType = "text/event-stream" +const ContentType = "text/event-stream;charset=utf-8" var contentType = []string{ContentType} var noCache = []string{"no-cache"} @@ -72,6 +72,14 @@ func writeRetry(w stringWriter, retry uint) { func writeData(w stringWriter, data interface{}) error { w.WriteString("data:") + + bData, ok := data.([]byte) + if ok { + dataReplacer.WriteString(w, string(bData)) + w.WriteString("\n\n") + return nil + } + switch kindOfData(data) { case reflect.Struct, reflect.Slice, reflect.Map: err := json.NewEncoder(w).Encode(data) |
