diff --git a/api.go b/api.go index 5650fbf..b3f4a5f 100644 --- a/api.go +++ b/api.go @@ -6,7 +6,7 @@ import ( "net/http" "net/url" "fmt" - "github.com/di4f/bond/contents" + "vultras.su/core/bond/contents" ) type Decoder interface { @@ -14,6 +14,7 @@ type Decoder interface { } type Func func(*Context) + func (fn Func) ServeHTTP(w ResponseWriter, r *Request) { fn(&Context{ R: r, @@ -28,7 +29,7 @@ type Context struct { Data any scanErr error - dec Decoder + dec Decoder } func (c *Context) SetContentType(typ contents.Type) { @@ -66,7 +67,7 @@ func (c *Context) Scan(v any) bool { if c.dec == nil { typ := c.ContentType() switch typ { - case contents.Json : + case contents.Json: c.dec = json.NewDecoder(c.R.Body) default: c.scanErr = UnknownContentTypeErr diff --git a/cmd/test/main.go b/cmd/test/main.go index 844da8c..945b965 100644 --- a/cmd/test/main.go +++ b/cmd/test/main.go @@ -1,13 +1,13 @@ package main import ( - "github.com/di4f/bond" - "github.com/di4f/bond/methods" - "github.com/di4f/bond/contents" + "vultras.su/core/bond" + "vultras.su/core/bond/methods" + "vultras.su/core/bond/contents" ) type GetNotesOptions struct { - Id int `json:"id"` + Id int `json:"id"` Name string `json:"name"` } @@ -54,7 +54,7 @@ var root = bond.Mux(). "get-notes", bond.Method().Def( methods.Get, - bond.Func(func(c *bond.Context){ + bond.Func(func(c *bond.Context) { opts := GetNotesOptions{} c.Scan(&opts) c.Printf("%v", opts) diff --git a/go.mod b/go.mod index b293647..f22545d 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/di4f/bond +module vultras.su/core/bond go 1.21.3 diff --git a/method.go b/method.go index a4905a2..f5bb74d 100644 --- a/method.go +++ b/method.go @@ -2,18 +2,18 @@ package bond import ( "net/http" - "github.com/di4f/bond/methods" + "vultras.su/core/bond/methods" ) // The type implements functionality for multiplexing // the methods. type MethodRouter struct { - methodMap map[methods.Method] Handler + methodMap map[methods.Method]Handler } func Method() *MethodRouter { ret := &MethodRouter{} - ret.methodMap = make(map[methods.Method] Handler) + ret.methodMap = make(map[methods.Method]Handler) return ret } diff --git a/taskfile.yml b/taskfile.yml index b6ca3f8..9694e4c 100644 --- a/taskfile.yml +++ b/taskfile.yml @@ -3,5 +3,5 @@ version: 3 tasks: btest: cmds: - - go build -o ./test ./cmd/test/ + - go build ./cmd/test/