mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-04 20:08:38 +00:00
Fix replay to be like the test (#1173)
Represent should get entry that Marshaled and UnMarshaled
This commit is contained in:
parent
2e7fd34210
commit
3a9236a381
@ -136,7 +136,26 @@ func ExecuteRequest(replayData *Details, timeout time.Duration) *Response {
|
|||||||
entry := getEntryFromRequestResponse(extension, request, response)
|
entry := getEntryFromRequestResponse(extension, request, response)
|
||||||
base := extension.Dissector.Summarize(entry)
|
base := extension.Dissector.Summarize(entry)
|
||||||
var representation []byte
|
var representation []byte
|
||||||
representation, err = extension.Dissector.Represent(entry.Request, entry.Response)
|
|
||||||
|
// Represent is expecting an entry that's marshalled and unmarshalled
|
||||||
|
entryMarshalled, err := json.Marshal(entry)
|
||||||
|
if err != nil {
|
||||||
|
return &Response{
|
||||||
|
Success: false,
|
||||||
|
Data: nil,
|
||||||
|
ErrorMessage: err.Error(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var entryUnmarshalled *tapApi.Entry
|
||||||
|
if err := json.Unmarshal(entryMarshalled, &entryUnmarshalled); err != nil {
|
||||||
|
return &Response{
|
||||||
|
Success: false,
|
||||||
|
Data: nil,
|
||||||
|
ErrorMessage: err.Error(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
representation, err = extension.Dissector.Represent(entryUnmarshalled.Request, entryUnmarshalled.Response)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &Response{
|
return &Response{
|
||||||
Success: false,
|
Success: false,
|
||||||
@ -150,7 +169,7 @@ func ExecuteRequest(replayData *Details, timeout time.Duration) *Response {
|
|||||||
Data: &tapApi.EntryWrapper{
|
Data: &tapApi.EntryWrapper{
|
||||||
Protocol: *extension.Protocol,
|
Protocol: *extension.Protocol,
|
||||||
Representation: string(representation),
|
Representation: string(representation),
|
||||||
Data: entry,
|
Data: entryUnmarshalled,
|
||||||
Base: base,
|
Base: base,
|
||||||
Rules: nil,
|
Rules: nil,
|
||||||
IsRulesEnabled: false,
|
IsRulesEnabled: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user