1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-01-06 00:18:50 +02:00

[#1956] normalized _requests.method to UPPERCASE

This commit is contained in:
Gani Georgiev 2023-03-02 15:15:00 +02:00
parent 41f01bab0d
commit 07727dbde6
3 changed files with 24 additions and 1 deletions

View File

@ -1,3 +1,8 @@
## (WIP) v0.14.0
- Normalized the request logs `method` value to UPPERCASE, eg. "get" => "GET" ([#1956](https://github.com/pocketbase/pocketbase/discussions/1956)).
## v0.13.0
- Added new "View" collection type allowing you to create a read-only collection from a custom SQL `SELECT` statement. It supports:

View File

@ -321,7 +321,7 @@ func ActivityLogger(app core.App) echo.MiddlewareFunc {
model := &models.Request{
Url: httpRequest.URL.RequestURI(),
Method: strings.ToLower(httpRequest.Method),
Method: strings.ToUpper(httpRequest.Method),
Status: status,
Auth: requestAuth,
UserIp: realUserIp(httpRequest, ip),

View File

@ -0,0 +1,18 @@
package logs
import (
"github.com/pocketbase/dbx"
)
// This migrations converts all logs "method" valus to all UPPERCASE (eg. "get" => "GET").
func init() {
LogsMigrations.Register(func(db dbx.Builder) error {
_, err := db.NewQuery("UPDATE {{_requests}} SET method=UPPER(method)").Execute()
return err
}, func(db dbx.Builder) error {
_, err := db.NewQuery("UPDATE {{_requests}} SET method=LOWER(method)").Execute()
return err
})
}