Skip to content

Conversation

@hbakouane
Copy link

@hbakouane hbakouane commented Nov 22, 2025

image

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant