package logbook.internal.proxy;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

public class CaptureHolder {

    private List<byte[]> req = new ArrayList<>();

    private List<byte[]> res = new ArrayList<>();

    public void putRequest(byte[] data) {
        this.req.add(data);
    }

    public InputStream getRequest() {
        return new ByteArrayInputStream2(this.req);
    }

    public void putResponse(byte[] data) {
        this.res.add(data);
    }

    public InputStream getResponse() {
        return new ByteArrayInputStream2(this.res);
    }

    public void clear() {
        this.req = null;
        this.res = null;
    }
}

@@ -86,16 +86,42 @@
 yList;%0D%0A
+import java.util.Arrays;%0D%0A
 import j
@@ -311,32 +311,278 @@
 byte%5B%5D data) %7B%0D%0A
+        if (this.req.size() %3E 0 && Arrays.equals(this.req.get(this.req.size()-1), data)) %7B%0D%0A            // if the data is the same as the last one in this.req array, no need to add this to req as it is duplicated%0D%0A            return;%0D%0A        %7D%0D%0A
         this.req

Fix #158 重複した request を追加しない