Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions echotest/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ type ContextConfig struct {
// Response will be used instead of default `httptest.NewRecorder()`
Response *httptest.ResponseRecorder

// QueryValues wil be set as Request.URL.RawQuery value
// QueryValues will be set as Request.URL.RawQuery value
QueryValues url.Values

// Headers wil be set as Request.Header value
// Headers will be set as Request.Header value
Headers http.Header

// PathValues initializes context.PathValues with given value.
Expand Down
2 changes: 1 addition & 1 deletion middleware/csrf.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type CSRFConfig struct {
Skipper Skipper
// TrustedOrigin permits any request with `Sec-Fetch-Site` header whose `Origin` header
// exactly matches the specified value.
// Values should be formated as Origin header "scheme://host[:port]".
// Values should be formatted as Origin header "scheme://host[:port]".
//
// See [Origin]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin
// See [Sec-Fetch-Site]: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#fetch-metadata-headers
Expand Down
2 changes: 1 addition & 1 deletion middleware/request_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func RequestLogger() echo.MiddlewareFunc {
LogContentLength: true,
LogResponseSize: true,
// forwards error to the global error handler, so it can decide appropriate status code.
// NB: side-effect of that is - request is now "commited" written to the client. Middlewares up in chain can not
// NB: side-effect of that is - request is now "committed" written to the client. Middlewares up in chain can not
// change Response status code or response body.
HandleError: true,
LogValuesFunc: func(c *echo.Context, v RequestLoggerValues) error {
Expand Down
10 changes: 5 additions & 5 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,19 @@ func UnwrapResponse(rw http.ResponseWriter) (*Response, error) {
// This allows (global) error handler to decide correct status code to be sent to the client.
type delayedStatusWriter struct {
http.ResponseWriter
commited bool
committed bool
status int
}

func (w *delayedStatusWriter) WriteHeader(statusCode int) {
// in case something else writes status code explicitly before us we need mark response commited
w.commited = true
// in case something else writes status code explicitly before us we need mark response committed
w.committed = true
w.ResponseWriter.WriteHeader(statusCode)
}

func (w *delayedStatusWriter) Write(data []byte) (int, error) {
if !w.commited {
w.commited = true
if !w.committed {
w.committed = true
if w.status == 0 {
w.status = http.StatusOK
}
Expand Down
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type StartConfig struct {
// ListenerNetwork is used configure on which Network listener will use.
ListenerNetwork string
// ListenerAddrFunc will be called after listener is created and started to listen for connections. This is useful in
// testing situations when server is started on random port `addres = ":0"` in that case you can get actual port where
// testing situations when server is started on random port `address = ":0"` in that case you can get actual port where
// listener is listening on.
ListenerAddrFunc func(addr net.Addr)

Expand Down
Loading