Skip to content

Commit

Permalink
Update copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
m110 committed Apr 21, 2024
1 parent 5642a1b commit d2d3018
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/http/sse_marshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (j JSONSSEMarshaler) Marshal(ctx context.Context, payload any) (ServerSentE

type StringSSEMarshaler struct{}

func (b StringSSEMarshaler) Marshal(ctx context.Context, payload any) (ServerSentEvent, error) {
func (s StringSSEMarshaler) Marshal(ctx context.Context, payload any) (ServerSentEvent, error) {
data := fmt.Sprint(payload)

return ServerSentEvent{
Expand Down
27 changes: 26 additions & 1 deletion pkg/http/sse_responder.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,38 @@ import (
"github.com/go-chi/render"
)

/*
Code based on [go-chi/render](https:/go-chi/render)
Original code copyright (c) 2016-Present https:/go-chi authors
Modifications copyright (c) 2024 Three Dots Labs
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

type sseResponder struct {
marshaler SSEMarshaler
}

// Respond handles streaming JSON and XML responses, automatically setting the
// Content-Type based on request headers.
// Based on go-chi/render.
func (s sseResponder) Respond(w http.ResponseWriter, r *http.Request, v interface{}) {
if v != nil {
switch reflect.TypeOf(v).Kind() {
Expand Down

0 comments on commit d2d3018

Please sign in to comment.