mirror of https://github.com/gofiber/fiber.git
🧹🧹 Cleanup
parent
c134e1580c
commit
1d4478bf00
4
app.go
4
app.go
|
@ -24,7 +24,7 @@ import (
|
|||
|
||||
utils "github.com/gofiber/utils"
|
||||
colorable "github.com/mattn/go-colorable"
|
||||
"github.com/mattn/go-isatty"
|
||||
isatty "github.com/mattn/go-isatty"
|
||||
fasthttp "github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
|
@ -655,6 +655,8 @@ func (app *App) startupMessage(addr string, tls bool, pids string) {
|
|||
// colorable handles the escape sequence for stdout using ascii color codes
|
||||
var out *tabwriter.Writer
|
||||
// Check if colors are supported
|
||||
fmt.Println(isatty.IsTerminal(os.Stdout.Fd()))
|
||||
fmt.Println(isatty.IsCygwinTerminal(os.Stdout.Fd()))
|
||||
if os.Getenv("TERM") == "dumb" ||
|
||||
(!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd())) {
|
||||
out = tabwriter.NewWriter(colorable.NewNonColorable(os.Stdout), 0, 0, 2, ' ', 0)
|
||||
|
|
4
ctx.go
4
ctx.go
|
@ -203,7 +203,7 @@ func (ctx *Ctx) Attachment(filename ...string) {
|
|||
|
||||
// BaseURL returns (protocol + host + base path).
|
||||
func (ctx *Ctx) BaseURL() string {
|
||||
// TODO: avoid allocation 53.8 ns/op 32 B/op 1 allocs/op
|
||||
// TODO: Could be improved: 53.8 ns/op 32 B/op 1 allocs/op
|
||||
// Should work like https://codeigniter.com/user_guide/helpers/url_helper.html
|
||||
return ctx.Protocol() + "://" + ctx.Hostname()
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ func (ctx *Ctx) Body() string {
|
|||
// It supports decoding the following content types based on the Content-Type header:
|
||||
// application/json, application/xml, application/x-www-form-urlencoded, multipart/form-data
|
||||
func (ctx *Ctx) BodyParser(out interface{}) error {
|
||||
// TODO: Create benchmark ( Prolly need a sync pool )
|
||||
// TODO: Create benchmark ( Probably need a sync pool )
|
||||
var schemaDecoderForm = schema.NewDecoder()
|
||||
var schemaDecoderQuery = schema.NewDecoder()
|
||||
schemaDecoderForm.SetAliasTag("form")
|
||||
|
|
|
@ -414,7 +414,7 @@ func Benchmark_Ctx_Format_XML(b *testing.B) {
|
|||
|
||||
// go test -run Test_Ctx_FormFile
|
||||
func Test_Ctx_FormFile(t *testing.T) {
|
||||
// TODO: CLEAN THIS UP
|
||||
// TODO: We should clean this up
|
||||
t.Parallel()
|
||||
app := New()
|
||||
|
||||
|
@ -791,7 +791,7 @@ func Test_Ctx_RouteNormalized(t *testing.T) {
|
|||
|
||||
// go test -run Test_Ctx_SaveFile
|
||||
func Test_Ctx_SaveFile(t *testing.T) {
|
||||
// TODO CLEAN THIS UP
|
||||
// TODO We should clean this up
|
||||
t.Parallel()
|
||||
app := New()
|
||||
|
||||
|
|
13
path_test.go
13
path_test.go
|
@ -197,16 +197,3 @@ func Test_Path_matchParams(t *testing.T) {
|
|||
{url: "xyz/", params: nil, match: false},
|
||||
})
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
///////////////// BENCHMARKS /////////////////
|
||||
//////////////////////////////////////////////
|
||||
// go test -v -run=^$ -bench=Benchmark_Path_ -benchmem -count=3
|
||||
|
||||
// func Benchmark_Path_paramsForPos(b *testing.B) {
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
// func Benchmark_Path_matchParams(b *testing.B) {
|
||||
// // TODO
|
||||
// }
|
||||
|
|
|
@ -73,26 +73,6 @@ func Test_Utils_getGroupPath(t *testing.T) {
|
|||
utils.AssertEqual(t, "/v1/api/", res)
|
||||
}
|
||||
|
||||
// func Test_Utils_getArgument(t *testing.T) {
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
// func Test_Utils_parseTokenList(t *testing.T) {
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
// func Test_Utils_getParams(t *testing.T) {
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
// func Test_Utils_getTrimmedParam(t *testing.T) {
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
// func Test_Utils_getCharPos(t *testing.T) {
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
//////////////////////////////////////////////
|
||||
///////////////// BENCHMARKS /////////////////
|
||||
//////////////////////////////////////////////
|
||||
|
@ -109,14 +89,6 @@ func Benchmark_Utils_getGroupPath(b *testing.B) {
|
|||
utils.AssertEqual(b, "/v1/api/register/:project", res)
|
||||
}
|
||||
|
||||
// func Benchmark_Utils_getArgument(b *testing.B) {
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
// func Benchmark_Utils_parseTokenList(b *testing.B) {
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
func Benchmark_Utils_Unescape(b *testing.B) {
|
||||
unescaped := ""
|
||||
dst := make([]byte, 0)
|
||||
|
|
Loading…
Reference in New Issue