mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 02:52:25 -06:00
[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>
This commit is contained in:
parent
2a46681147
commit
5c96702cb5
80 changed files with 5055 additions and 114881 deletions
3
vendor/github.com/gin-contrib/sse/.golangci.yml
generated
vendored
Normal file
3
vendor/github.com/gin-contrib/sse/.golangci.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
linters:
|
||||
disable:
|
||||
- errcheck
|
||||
29
vendor/github.com/gin-contrib/sse/.goreleaser.yaml
generated
vendored
Normal file
29
vendor/github.com/gin-contrib/sse/.goreleaser.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
builds:
|
||||
- # If true, skip the build.
|
||||
# Useful for library projects.
|
||||
# Default is false
|
||||
skip: true
|
||||
|
||||
changelog:
|
||||
use: github
|
||||
groups:
|
||||
- title: Features
|
||||
regexp: "^.*feat[(\\w)]*:+.*$"
|
||||
order: 0
|
||||
- title: "Bug fixes"
|
||||
regexp: "^.*fix[(\\w)]*:+.*$"
|
||||
order: 1
|
||||
- title: "Enhancements"
|
||||
regexp: "^.*chore[(\\w)]*:+.*$"
|
||||
order: 2
|
||||
- title: "Refactor"
|
||||
regexp: "^.*refactor[(\\w)]*:+.*$"
|
||||
order: 3
|
||||
- title: "Build process updates"
|
||||
regexp: ^.*?(build|ci)(\(.+\))??!?:.+$
|
||||
order: 4
|
||||
- title: "Documentation updates"
|
||||
regexp: ^.*?docs?(\(.+\))??!?:.+$
|
||||
order: 4
|
||||
- title: Others
|
||||
order: 999
|
||||
26
vendor/github.com/gin-contrib/sse/.travis.yml
generated
vendored
26
vendor/github.com/gin-contrib/sse/.travis.yml
generated
vendored
|
|
@ -1,26 +0,0 @@
|
|||
language: go
|
||||
sudo: false
|
||||
go:
|
||||
- 1.8.x
|
||||
- 1.9.x
|
||||
- 1.10.x
|
||||
- 1.11.x
|
||||
- 1.12.x
|
||||
- master
|
||||
|
||||
git:
|
||||
depth: 10
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- go: 1.11.x
|
||||
env: GO111MODULE=on
|
||||
- go: 1.12.x
|
||||
env: GO111MODULE=on
|
||||
|
||||
script:
|
||||
- go test -v -covermode=count -coverprofile=coverage.out
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
42
vendor/github.com/gin-contrib/sse/README.md
generated
vendored
42
vendor/github.com/gin-contrib/sse/README.md
generated
vendored
|
|
@ -1,7 +1,7 @@
|
|||
# Server-Sent Events
|
||||
|
||||
[](https://godoc.org/github.com/gin-contrib/sse)
|
||||
[](https://travis-ci.org/gin-contrib/sse)
|
||||
[](https://pkg.go.dev/github.com/gin-contrib/sse)
|
||||
[](https://github.com/gin-contrib/sse/actions/workflows/go.yml)
|
||||
[](https://codecov.io/gh/gin-contrib/sse)
|
||||
[](https://goreportcard.com/report/github.com/gin-contrib/sse)
|
||||
|
||||
|
|
@ -16,32 +16,33 @@ Server-sent events (SSE) is a technology where a browser receives automatic upda
|
|||
import "github.com/gin-contrib/sse"
|
||||
|
||||
func httpHandler(w http.ResponseWriter, req *http.Request) {
|
||||
// data can be a primitive like a string, an integer or a float
|
||||
sse.Encode(w, sse.Event{
|
||||
Event: "message",
|
||||
Data: "some data\nmore data",
|
||||
})
|
||||
// data can be a primitive like a string, an integer or a float
|
||||
sse.Encode(w, sse.Event{
|
||||
Event: "message",
|
||||
Data: "some data\nmore data",
|
||||
})
|
||||
|
||||
// also a complex type, like a map, a struct or a slice
|
||||
sse.Encode(w, sse.Event{
|
||||
Id: "124",
|
||||
Event: "message",
|
||||
Data: map[string]interface{}{
|
||||
"user": "manu",
|
||||
"date": time.Now().Unix(),
|
||||
"content": "hi!",
|
||||
},
|
||||
})
|
||||
// also a complex type, like a map, a struct or a slice
|
||||
sse.Encode(w, sse.Event{
|
||||
Id: "124",
|
||||
Event: "message",
|
||||
Data: map[string]interface{}{
|
||||
"user": "manu",
|
||||
"date": time.Now().Unix(),
|
||||
"content": "hi!",
|
||||
},
|
||||
})
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
```sh
|
||||
event: message
|
||||
data: some data\\nmore data
|
||||
|
||||
id: 124
|
||||
event: message
|
||||
data: {"content":"hi!","date":1431540810,"user":"manu"}
|
||||
|
||||
|
||||
```
|
||||
|
||||
## Content-Type
|
||||
|
|
@ -49,7 +50,8 @@ data: {"content":"hi!","date":1431540810,"user":"manu"}
|
|||
```go
|
||||
fmt.Println(sse.ContentType)
|
||||
```
|
||||
```
|
||||
|
||||
```sh
|
||||
text/event-stream
|
||||
```
|
||||
|
||||
|
|
|
|||
10
vendor/github.com/gin-contrib/sse/sse-encoder.go
generated
vendored
10
vendor/github.com/gin-contrib/sse/sse-encoder.go
generated
vendored
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue