mirror of
https://github.com/gin-gonic/gin.git
synced 2025-04-06 03:57:46 +08:00
Merge cb0a76caf675620bb3268153128ca2adac317d9a into 8763f33c65f7df8be5b9fe7504ab7fcf20abb41d
This commit is contained in:
commit
8086c6cf17
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