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