Skip to content
Myr

chore: update some code style (#2356)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by thinkerou · committed by GitHub · parent 54175db · Browse files · 5 files+11 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+11 added−11 removed

  • other:+11 added−11 removed

5 files+11 added−11 removed

modified:internal/json/jsoniter.go+1 added-1 removed
4 unmodified lines
5// +build jsoniter67package json89import "github.com/json-iterator/go"9import jsoniter "github.com/json-iterator/go"1011var (12 json = jsoniter.ConfigCompatibleWithStandardLibrary13 // Marshal is exported by gin/json package.
10 unmodified lines
modified:context.go+1 added-1 removed
863 unmodified lines
864// SecureJSON serializes the given struct as Secure JSON into the response body.865// Default prepends "while(1)," to response body if the given struct is array values.866// It also sets the Content-Type as "application/json".867func (c *Context) SecureJSON(code int, obj interface{}) {868 c.Render(code, render.SecureJSON{Prefix: c.engine.secureJsonPrefix, Data: obj})868 c.Render(code, render.SecureJSON{Prefix: c.engine.secureJSONPrefix, Data: obj})869}870871// JSONP serializes the given struct as JSON into the response body.872// It add padding to response body to request data from a server residing in a different domain than the client.
236 unmodified lines
modified:gin.go+4 added-4 removed
102 unmodified lines
103 // See the PR #1817 and issue #1644104 RemoveExtraSlash bool105106 delims render.Delims107 secureJsonPrefix string107 secureJSONPrefix string108 HTMLRender render.HTMLRender109 FuncMap template.FuncMap110 allNoRoute HandlersChain111 allNoMethod HandlersChain
32 unmodified lines
144 UnescapePathValues: true,145 MaxMultipartMemory: defaultMultipartMemory,146 trees: make(methodTrees, 0, 9),147 delims: render.Delims{Left: "{{", Right: "}}"},148 secureJsonPrefix: "while(1);",148 secureJSONPrefix: "while(1);",149 }150 engine.RouterGroup.engine = engine151 engine.pool.New = func() interface{} {152 return engine.allocateContext()
18 unmodified lines
171 engine.delims = render.Delims{Left: left, Right: right}172 return engine173}174175// SecureJsonPrefix sets the secureJsonPrefix used in Context.SecureJSON.175// SecureJsonPrefix sets the secureJSONPrefix used in Context.SecureJSON.176func (engine *Engine) SecureJsonPrefix(prefix string) *Engine {177 engine.secureJsonPrefix = prefix177 engine.secureJSONPrefix = prefix178 return engine179}180181// LoadHTMLGlob loads HTML files identified by glob pattern
317 unmodified lines
modified:githubapi_test.go+4 added-4 removed
289 unmodified lines
290 router := New()291292 type Person struct {293 Name string `uri:"name" binding:"required"`294 Id string `uri:"id" binding:"required"`294 ID string `uri:"id" binding:"required"`295 }296 router.Handle(http.MethodGet, "/rest/:name/:id", func(c *Context) {297 var person Person298 assert.NoError(t, c.ShouldBindUri(&person))299 assert.True(t, "" != person.Name)300 assert.True(t, "" != person.Id)300 assert.True(t, "" != person.ID)301 c.String(http.StatusOK, "ShouldBindUri test OK")302 })303304 path, _ := exampleFromPath("/rest/:name/:id")
7 unmodified lines
312 router := New()313314 type Person struct {315 Name string `uri:"name" binding:"required"`316 Id string `uri:"id" binding:"required"`316 ID string `uri:"id" binding:"required"`317 }318 router.Handle(http.MethodGet, "/rest/:name/:id", func(c *Context) {319 var person Person320 assert.NoError(t, c.BindUri(&person))321 assert.True(t, "" != person.Name)322 assert.True(t, "" != person.Id)322 assert.True(t, "" != person.ID)323 c.String(http.StatusOK, "BindUri test OK")324 })325326 path, _ := exampleFromPath("/rest/:name/:id")
148 unmodified lines
modified:routes_test.go+1 added-1 removed
512 unmodified lines
513514 // Middleware must be called just only once by per request.515 middlewareCalledNum := 0516 router.Use(func(c *Context) {517 middlewareCalledNum += 1517 middlewareCalledNum++518 })519520 router.StaticFS("/", http.FileSystem(http.Dir("/thisreallydoesntexist/")))521
99 unmodified lines