Feat:ability to copy a request as curl #1657
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Usage
This PR adds a new “Copy as cURL” action to the Laravel Telescope request inspector.
It allows developers to instantly copy any captured HTTP request as a fully-formed cURL command that can be executed directly in the terminal.
When debugging APIs or replicating complex HTTP interactions, developers often need to manually reconstruct a request—including method, headers, payload, and URL. Manually building this cURL command is time-consuming and error-prone, especially when requests contain nested JSON payloads or multiple headers.
Telescope already captures all the necessary request metadata, so adding a one-click copy option significantly improves debugging workflow.
What this PR adds
A “Copy cURL” button in the Request entry screen.
Backend logic that converts a Telescope request entry into a properly escaped and formatted cURL command.
Support for:
HTTP method (GET, POST, etc.)
Full URL
All headers recorded by Telescope
Raw payload body (string, JSON, or form data)
Frontend clipboard integration using navigator.clipboard.writeText.
Benefits to end users
Greatly improves productivity when debugging or reproducing API requests.
Eliminates manual reconstruction of headers, tokens, and payloads.
Ensures cURL commands exactly match the original request.
Useful for:
API developers
Backend debugging
Reproducing issues reported in logs
Security auditing
Backward compatibility
This PR does not modify any existing Telescope behavior or internal structures.
All changes are additive and scoped to the Request entry UI and controller.
No breaking changes are introduced.