Skip to content

Added feature request/response title #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/main/java/ch/csnc/burp/CopyRequestResponseCopyActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static void copyFullFull(List<HttpRequestResponse> requestResponses) {
requestResponses
.stream()
.map(requestResponse ->
"%s\n\n%s".formatted(
"Request\n-----------------\n%s\n\nResponse\n-----------------\n%s".formatted(
requestResponse.request().toString().strip(),
Optional.ofNullable(requestResponse.response())
.map(HttpResponse::toString)
Expand All @@ -37,12 +37,12 @@ public static void copyFullHeader(List<HttpRequestResponse> requestResponses) {
requestResponses
.stream()
.map(requestResponse -> {
var requestString = requestResponse.request().toString().strip();
var requestString = "Request\n-----------------\n" + requestResponse.request().toString().strip();

var responseString = "";
if (requestResponse.hasResponse()) {
var response = requestResponse.response();
responseString = response.toString().substring(0, response.bodyOffset()).strip();
responseString = "Response\n-----------------\n" + response.toString().substring(0, response.bodyOffset()).strip();
responseString += "\n\n";
responseString += CopyRequestResponseConfiguration.cutText();
}
Expand All @@ -56,15 +56,15 @@ public static void copyFullHeader(List<HttpRequestResponse> requestResponses) {

public static void copyFullHeaderPlusSelectedData(MessageEditorHttpRequestResponse editor) {
var requestResponse = editor.requestResponse();
var requestString = requestResponse.request().toString().strip();
var requestString = "Request\n-----------------\n" + requestResponse.request().toString().strip();

Supplier<String> responseStringSupplier = () -> {
if (!requestResponse.hasResponse()) {
return "";
}

var response = requestResponse.response();
var responseString = response.toString().substring(0, response.bodyOffset()).strip();
var responseString = "Response\n-----------------\n" + response.toString().substring(0, response.bodyOffset()).strip();
responseString += "\n\n";


Expand Down Expand Up @@ -114,7 +114,7 @@ public static void copyFullHeaderPlusSelectedData(MessageEditorHttpRequestRespon
};

var text = "%s\n\n%s".formatted(requestString, responseStringSupplier.get());

// Ugly hack because VMware is messing up the clipboard if a text is still selected, the function
// has to be run in a separate thread which sleeps for 0.2 seconds.
var thread = new Thread(() -> {
Expand Down Expand Up @@ -143,4 +143,4 @@ private CopyRequestResponseCopyActions() {
// static class
}

}
}