Fix replay to be like the test (#1173)

Represent should get entry that Marshaled and UnMarshaled
This commit is contained in:
gadotroee 2022-06-29 11:54:16 +03:00 committed by GitHub
parent 2e7fd34210
commit 3a9236a381
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,