DevTools: the Network Tab
Press the buttons of a mini interface: get the list, create and delete a product. See which requests and responses appear in Network.
About the task
Press the buttons of a mini interface: get the list, create and delete a product. See which requests and responses appear in Network.
Application under test
Now the Network tab. I’ll show how to read requests, and then you’ll press the buttons of a mini interface yourself.
What does Network show?
A table of requests: name (address), method, status, size and time. Click a row to open its details: Headers — address, method and status; Payload — what went in the request body; Response — what the server answered.
If you only want API requests, turn on the Fetch/XHR filter. The Clear button removes old rows.
Let’s start with the first request. Press “Get product list” in the admin. The request appears in Network: click the row and look at the details.
Done 0 of 3
BB Food admin
Network
| Name | Status | Method |
|---|
No requests yet. Press a button on the left.
Headers
Payload
Response
This is a GET — the method for reading data. Status 200: all good. Response holds the JSON list of products and Payload is empty: GET sends nothing in the request body.
What will be in Payload for the GET request that fetches the list?
Now the second request. A form appeared in the admin: enter a name and a price and press “Create”. Then open the new row in Network.
This is a POST — the method for creating. Status 201 Created: the product is created. Payload holds the name and price without an id, and Response holds the created product with an id already: the server issued it.
What status did the server answer to creating a product?
Where in DevTools do you see the request body that went to the server?
And the last request. A product picker appeared in the admin: choose any product and press “Delete”. The product list isn’t shown here, so the result is checked with a separate request.
This is a DELETE — the method for deleting. The product id is right in the address, status 204 No Content, and Response is empty: the server returned nothing, and that is fine.
How do you make sure the product is really deleted?
Great! Now you can read any request of a page. Application is left.
Quick reference
DevTools
The developer tools built into the browser. Open them with F12 or Ctrl+Shift+I (Cmd+Option+I on Mac).
Network
A table of the page’s requests. Clicking a row opens Headers (address, method, status), Payload (request body) and Response. The Fetch/XHR filter leaves only API requests.
Application
Browser storage: Cookies, Local Storage, Session Storage. Records can be viewed, edited and deleted.
Cookie
The browser sends cookies to the server with every request.