Renamed send to content
This commit is contained in:
parent
797da600d3
commit
50d5659168
@ -1,4 +1,4 @@
|
|||||||
package send
|
package content
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
@ -1,4 +1,4 @@
|
|||||||
package send_test
|
package content_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
@ -9,38 +9,38 @@ import (
|
|||||||
|
|
||||||
"git.akyoto.dev/go/assert"
|
"git.akyoto.dev/go/assert"
|
||||||
"git.akyoto.dev/go/server"
|
"git.akyoto.dev/go/server"
|
||||||
"git.akyoto.dev/go/server/send"
|
"git.akyoto.dev/go/server/content"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestContentTypes(t *testing.T) {
|
func TestContentTypes(t *testing.T) {
|
||||||
s := server.New()
|
s := server.New()
|
||||||
|
|
||||||
s.Get("/css", func(ctx server.Context) error {
|
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 {
|
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 {
|
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 {
|
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 {
|
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 {
|
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 {
|
s.Get("/xml", func(ctx server.Context) error {
|
||||||
return send.XML(ctx, "<xml></xml>")
|
return content.XML(ctx, "<xml></xml>")
|
||||||
})
|
})
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
Loading…
Reference in New Issue
Block a user