Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/fuzz/dataformat/raw.go
2070 views
1
package dataformat
2
3
type Raw struct{}
4
5
var (
6
_ DataFormat = &Raw{}
7
)
8
9
// NewRaw returns a new Raw encoder
10
func NewRaw() *Raw {
11
return &Raw{}
12
}
13
14
// IsType returns true if the data is Raw encoded
15
func (r *Raw) IsType(data string) bool {
16
return false
17
}
18
19
// Encode encodes the data into Raw format
20
func (r *Raw) Encode(data KV) (string, error) {
21
return data.Get("value").(string), nil
22
}
23
24
// Decode decodes the data from Raw format
25
func (r *Raw) Decode(data string) (KV, error) {
26
return KVMap(map[string]interface{}{
27
"value": data,
28
}), nil
29
}
30
31
// Name returns the name of the encoder
32
func (r *Raw) Name() string {
33
return RawDataFormat
34
}
35
36