mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 09:57:01 +00:00
release version 12.2.10
This commit is contained in:
@@ -50,11 +50,11 @@ func (r resource) loadFromBase(dir string) string {
|
||||
}
|
||||
|
||||
result := string(b)
|
||||
|
||||
if runtime.GOOS != "windows" {
|
||||
result = strings.ReplaceAll(result, "\n", "\r\n")
|
||||
result = strings.ReplaceAll(result, "\r\r", "")
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -50,6 +50,11 @@ func (r resource) loadFromBase(dir string) string {
|
||||
}
|
||||
|
||||
result := string(b)
|
||||
if runtime.GOOS != "windows" {
|
||||
result = strings.ReplaceAll(result, "\n", "\r\n")
|
||||
result = strings.ReplaceAll(result, "\r\r", "")
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
@@ -30,7 +33,8 @@ func TestJSONLogger(t *testing.T) {
|
||||
|
||||
app.Get("/ping", ping)
|
||||
|
||||
const expectedLogStr = `{"level":"debug","message":"Request path: /ping","fields":{"request_id":null},"stacktrace":[{"function":"json-logger/ping","source":"/home/runner/work/iris/iris/_examples/logging/json-logger/main.go:78"}]}` // gh actions-specific.
|
||||
expectedSourceDir := getSourceDirPath()
|
||||
expectedLogStr := fmt.Sprintf(`{"level":"debug","message":"Request path: /ping","fields":{"request_id":null},"stacktrace":[{"function":"json-logger/ping","source":"%s/main.go:78"}]}`, expectedSourceDir) // gh actions-specific.
|
||||
e := httptest.New(t, app, httptest.LogLevel("debug"))
|
||||
wg := new(sync.WaitGroup)
|
||||
wg.Add(iters)
|
||||
@@ -57,3 +61,12 @@ func TestJSONLogger(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func getSourceDirPath() string {
|
||||
_, file, _, ok := runtime.Caller(1) // get the caller's file.
|
||||
if !ok {
|
||||
return "unknown source"
|
||||
}
|
||||
|
||||
return path.Dir(file) // get the directory of the file (delimiter: /).
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user