Chrome DevTools: Replay a network request in cURL with the copy as cURL featureLast updated: 4th March 2021
Resources which show up in the network panel have a context menu which allows you to Copy as cURL, this will go into your clipboard at which point you can paste it into the command line, modify if necessary and then see the response. Request headers are also included.
How to use this feature
To use this feature:
- Load a page with the Network Panel open.
- Right click on resource and select Copy > Copy as cURL.
- Paste your clipboard contents into your terminal.
Why is this useful
This is especially useful as the corresponding cURL request includes the cookie information. This means pages behind a login will still work, and can be sent to others for diagnostic purposes.
In the example, I'm using iTerm 2 and the Numbers API.
fetch() request for a Network Panel resource.