poliakov-alex opened a new pull request, #6736: URL: https://github.com/apache/jmeter/pull/6736
Render the sampled HTTP request as a ready-to-run curl command in a new "cURL" sub-tab next to Raw and HTTP, so it can be copied or shared. Closes #6375 ## Description Adds a cURL tab to the Request panel of the View Results Tree listener, next to the existing Raw and HTTP tabs. It renders the sampled HTTP request as a ready-to-run curl command that can be copied or shared. The command includes the method (-X), the URL, request headers (-H), cookies (-b), and the request body (--data-raw). Values are single-quoted and shell-escaped so the output is paste-safe. Connection-specific (hop-by-hop) and curl-managed headers — Connection, Keep-Alive, Proxy-Connection, Transfer-Encoding, Upgrade, Content-Length — are omitted, because reproducing them makes the request fail (e.g. Connection is forbidden in HTTP/2 and produces curl: (92) ... PROTOCOL_ERROR, and a manual Content-Length conflicts with the body curl computes). The tab is contributed through the existing RequestView service interface (@AutoService), so no wiring changes were needed in RequestPanel. ## Motivation and Context Fixes [#6375](https://github.com/apache/jmeter/issues/6375). Users frequently need to reproduce a sampled request outside JMeter — in a terminal or when handing it to a developer. Today they must reconstruct the curl command by hand from the Raw/HTTP tabs. ## How Has This Been Tested? Added RequestViewCurlTest (8 JUnit tests) covering GET, headers, POST body, header skipping, cookie handling / de-duplication, single-quote escaping, and a null URL. Ran ./gradlew :src:protocol:http:test, checkstyleMain, checkstyleTest, autostyleJavaCheck — all green. Manually verified in the GUI: ran an HTTP sampler, opened View Results Tree → Request → cURL, copied the command and executed it in a terminal successfully. ## Screenshots (if appropriate): <img width="1382" height="867" alt="image" src="https://github.com/user-attachments/assets/a350792f-b710-4771-a768-48ddf6220486" /> ## Types of changes New feature (non-breaking change which adds functionality) ## Checklist: - [ ] My code follows the [code style][style-guide] of this project. - [ ] I have updated the documentation accordingly. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
