«   Previous tip Next tip   »

Chrome DevTools: Replay a network request in cURL with the copy as cURL feature

Last updated: 4th March 2021
Replay a network request in cURL with the copy as cURL feature

Introduction

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:

  1. Load a page with the Network Panel open.
  2. Right click on resource and select Copy > Copy as cURL.
  3. 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.

Notes

In the example, I'm using iTerm 2 and the Numbers API.

Related Resource

You can also Copy as Fetch - this feature generates the JavaScript code necessary to execute a fetch() request for a Network Panel resource.

«   Previous tip Next tip   »

Sign up to receive a developer tip, in the form of a gif, in your inbox each week