bugfix Controller SaveToFile remove all temp file

This commit is contained in:
Stone-afk
2023-01-15 12:55:42 +08:00
committed by Ming Deng
parent 3e19b0a6aa
commit e455869ef6
6 changed files with 143 additions and 5 deletions

View File

@@ -102,7 +102,7 @@ func TestSetCookie(t *testing.T) {
output.Context.Reset(httptest.NewRecorder(), r)
for _, item := range c.valueGp {
params := item.item
var others = []interface{}{params.MaxAge, params.Path, params.Domain, params.Secure, params.HttpOnly, params.SameSite}
others := []interface{}{params.MaxAge, params.Path, params.Domain, params.Secure, params.HttpOnly, params.SameSite}
output.Context.SetCookie(params.Name, params.Value, others...)
got := output.Context.ResponseWriter.Header().Get("Set-Cookie")
if got != item.want {

View File

@@ -71,11 +71,13 @@ func TestBind(t *testing.T) {
{"/?human.Nick=astaxie", []testItem{{"human", Human{}, Human{Nick: "astaxie"}}}},
{"/?human.ID=888&human.Nick=astaxie&human.Ms=true&human[Pwd]=pass", []testItem{{"human", Human{}, Human{ID: 888, Nick: "astaxie", Ms: true, Pwd: "pass"}}}},
{"/?human[0].ID=888&human[0].Nick=astaxie&human[0].Ms=true&human[0][Pwd]=pass01&human[1].ID=999&human[1].Nick=ysqi&human[1].Ms=On&human[1].Pwd=pass02",
{
"/?human[0].ID=888&human[0].Nick=astaxie&human[0].Ms=true&human[0][Pwd]=pass01&human[1].ID=999&human[1].Nick=ysqi&human[1].Ms=On&human[1].Pwd=pass02",
[]testItem{{"human", []Human{}, []Human{
{ID: 888, Nick: "astaxie", Ms: true, Pwd: "pass01"},
{ID: 999, Nick: "ysqi", Ms: true, Pwd: "pass02"},
}}}},
}}},
},
{
"/?id=123&isok=true&ft=1.2&ol[0]=1&ol[1]=2&ul[]=str&ul[]=array&human.Nick=astaxie",