Updated formatting
This commit is contained in:
parent
c5ad01daee
commit
86448ac4a7
18 changed files with 18 additions and 18 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -5,4 +5,4 @@
|
|||
!*.md
|
||||
!*.mod
|
||||
!*.sum
|
||||
!*.txt
|
||||
!*.txt
|
|
@ -81,4 +81,4 @@ func (ctx *context) Status(status int) Context {
|
|||
func (ctx *context) String(body string) error {
|
||||
ctx.response.body = append(ctx.response.body, body...)
|
||||
return nil
|
||||
}
|
||||
}
|
|
@ -66,4 +66,4 @@ func TestRedirect(t *testing.T) {
|
|||
response := s.Request("GET", "/", nil, nil)
|
||||
assert.Equal(t, response.Status(), 301)
|
||||
assert.Equal(t, response.Header("Location"), "/target")
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package web
|
||||
|
||||
// Handler is a function that deals with the given request/response context.
|
||||
type Handler func(Context) error
|
||||
type Handler func(Context) error
|
|
@ -4,4 +4,4 @@ package web
|
|||
type Header struct {
|
||||
Key string
|
||||
Value string
|
||||
}
|
||||
}
|
|
@ -87,4 +87,4 @@ Please see the [license documentation](https://urbach.dev/license).
|
|||
|
||||
## Copyright
|
||||
|
||||
© 2024 Eduard Urbach
|
||||
© 2024 Eduard Urbach
|
|
@ -79,4 +79,4 @@ func (req *request) addParameter(key string, value string) {
|
|||
Key: key,
|
||||
Value: value,
|
||||
})
|
||||
}
|
||||
}
|
|
@ -51,4 +51,4 @@ func TestRequestParam(t *testing.T) {
|
|||
response := s.Request("GET", "/blog/my-article", nil, nil)
|
||||
assert.Equal(t, response.Status(), 200)
|
||||
assert.Equal(t, string(response.Body()), "my-article")
|
||||
}
|
||||
}
|
|
@ -76,4 +76,4 @@ func (res *response) Write(body []byte) (int, error) {
|
|||
func (res *response) WriteString(body string) (int, error) {
|
||||
res.body = append(res.body, body...)
|
||||
return len(body), nil
|
||||
}
|
||||
}
|
|
@ -97,4 +97,4 @@ func TestResponseHeaderOverwrite(t *testing.T) {
|
|||
assert.Equal(t, response.Status(), 200)
|
||||
assert.Equal(t, response.Header("Content-Type"), "text/html")
|
||||
assert.Equal(t, string(response.Body()), "")
|
||||
}
|
||||
}
|
|
@ -261,4 +261,4 @@ func (s *server) newContext() *context {
|
|||
status: 200,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
|
@ -203,4 +203,4 @@ func TestUnavailablePort(t *testing.T) {
|
|||
|
||||
s := web.NewServer()
|
||||
s.Run(":8080")
|
||||
}
|
||||
}
|
|
@ -12,4 +12,4 @@ func main() {
|
|||
})
|
||||
|
||||
s.Run(":8080")
|
||||
}
|
||||
}
|
2
go.mod
2
go.mod
|
@ -5,4 +5,4 @@ go 1.24
|
|||
require (
|
||||
git.urbach.dev/go/assert v0.0.0-20250225153414-fc1f84f19edf
|
||||
git.urbach.dev/go/router v0.0.0-20250601162231-e35d5715d1a5
|
||||
)
|
||||
)
|
2
go.sum
2
go.sum
|
@ -1,4 +1,4 @@
|
|||
git.urbach.dev/go/assert v0.0.0-20250225153414-fc1f84f19edf h1:BQWa5GKNUsA5CSUa/+UlFWYCEVe3IDDKRbVqBLK0mAE=
|
||||
git.urbach.dev/go/assert v0.0.0-20250225153414-fc1f84f19edf/go.mod h1:y9jGII9JFiF1HNIju0u87OyPCt82xKCtqnAFyEreCDo=
|
||||
git.urbach.dev/go/router v0.0.0-20250601162231-e35d5715d1a5 h1:3qlZjgWbrHw4LWM4uBzOTldbpqCLJdeSgvcYK6f3xpc=
|
||||
git.urbach.dev/go/router v0.0.0-20250601162231-e35d5715d1a5/go.mod h1:O+doTe0DZdT2XMsTY5pe6qUMqEEIAbwtX6Xp6EqHw34=
|
||||
git.urbach.dev/go/router v0.0.0-20250601162231-e35d5715d1a5/go.mod h1:O+doTe0DZdT2XMsTY5pe6qUMqEEIAbwtX6Xp6EqHw34=
|
2
http.go
2
http.go
|
@ -38,4 +38,4 @@ func parseURL(url string) (scheme string, host string, path string, query string
|
|||
|
||||
path = url
|
||||
return
|
||||
}
|
||||
}
|
|
@ -46,4 +46,4 @@ func Text(ctx web.Context, body string) error {
|
|||
func XML(ctx web.Context, body string) error {
|
||||
ctx.Response().SetHeader("Content-Type", "text/xml")
|
||||
return ctx.String(body)
|
||||
}
|
||||
}
|
|
@ -64,4 +64,4 @@ func TestContentTypes(t *testing.T) {
|
|||
assert.Equal(t, string(response.Body()), test.Response)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue