2020-12-20 18:34:11 +00:00
|
|
|
package output
|
|
|
|
|
2021-01-14 07:51:21 +00:00
|
|
|
import (
|
|
|
|
jsoniter "github.com/json-iterator/go"
|
|
|
|
)
|
2020-12-20 18:34:11 +00:00
|
|
|
|
|
|
|
// formatJSON formats the output for json based formatting
|
2020-12-25 15:03:52 +00:00
|
|
|
func (w *StandardWriter) formatJSON(output *ResultEvent) ([]byte, error) {
|
2021-09-09 13:23:55 +00:00
|
|
|
if !w.jsonReqResp { // don't show request-response in json if not asked
|
|
|
|
output.Request = ""
|
|
|
|
output.Response = ""
|
|
|
|
}
|
2020-12-25 07:25:46 +00:00
|
|
|
return jsoniter.Marshal(output)
|
2020-12-20 18:34:11 +00:00
|
|
|
}
|