Renamed content to send

This commit is contained in:
Eduard Urbach 2024-04-02 15:23:44 +02:00
parent b28a9f12ce
commit f0cb179b8b
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
2 changed files with 10 additions and 10 deletions

View File

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

View File

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