mirror of
https://github.com/gin-gonic/gin.git
synced 2025-12-13 13:12:17 +08:00
Merge cb0a76caf675620bb3268153128ca2adac317d9a into e88fc8927a52b74f55bec0351604a56ac0aa1c51
This commit is contained in:
commit
3c9425538d
21
render/fuzz.go
Normal file
21
render/fuzz.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Copyright 2020 Manu Martinez-Almeida. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build gofuzz
|
||||||
|
|
||||||
|
package render
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http/httptest"
|
||||||
|
)
|
||||||
|
|
||||||
|
func FuzzRender(data []byte) int {
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
(YAML{string(data)}).WriteContentType(w)
|
||||||
|
err := (YAML{string(data)}).Render(w)
|
||||||
|
if err != nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return 1
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user