Renamed send to content

This commit is contained in:
Eduard Urbach 2024-03-20 21:17:23 +01:00
parent 797da600d3
commit 50d5659168
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
2 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,4 @@
package send
package content
import (
"encoding/json"

View File

@ -1,4 +1,4 @@
package send_test
package content_test
import (
"io"
@ -9,38 +9,38 @@ import (
"git.akyoto.dev/go/assert"
"git.akyoto.dev/go/server"
"git.akyoto.dev/go/server/send"
"git.akyoto.dev/go/server/content"
)
func TestContentTypes(t *testing.T) {
s := server.New()
s.Get("/css", func(ctx server.Context) error {
return send.CSS(ctx, "body{}")
return content.CSS(ctx, "body{}")
})
s.Get("/csv", func(ctx server.Context) error {
return send.CSV(ctx, "ID;Name\n")
return content.CSV(ctx, "ID;Name\n")
})
s.Get("/html", func(ctx server.Context) error {
return send.HTML(ctx, "<html></html>")
return content.HTML(ctx, "<html></html>")
})
s.Get("/js", func(ctx server.Context) error {
return send.JS(ctx, "console.log(42)")
return content.JS(ctx, "console.log(42)")
})
s.Get("/json", func(ctx server.Context) error {
return send.JSON(ctx, struct{ Name string }{Name: "User 1"})
return content.JSON(ctx, struct{ Name string }{Name: "User 1"})
})
s.Get("/text", func(ctx server.Context) error {
return send.Text(ctx, "Hello")
return content.Text(ctx, "Hello")
})
s.Get("/xml", func(ctx server.Context) error {
return send.XML(ctx, "<xml></xml>")
return content.XML(ctx, "<xml></xml>")
})
tests := []struct {