# Testing an API with Supertest

Supertest hands a request straight to an Express app, with no server running and no port, so a test can check the status code, the headers and the JSON body that come back, for a GET and for a POST with a body.

![Cheat sheet: Testing an API with Supertest](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/5f56794609164435a3ec5627a1994970.webp)

- Category: Node.js
- Level: Journeyman
- Tags: Content-Type, End-to-End Test, nodejs, Supertest, Unit Test (unit-testing), unit testing
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/node-testing-supertest-cheat-sheet
