Renamed content to send
This commit is contained in:
parent
b28a9f12ce
commit
f0cb179b8b
@ -1,4 +1,4 @@
|
||||
package content
|
||||
package send
|
||||
|
||||
import (
|
||||
"encoding/json"
|
@ -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 {
|
Loading…
Reference in New Issue
Block a user