How to assert that app sends correct data to API server with POST request

I am writing React.js application talking to API server. I have read tons of articles on how to mock these calls and send some fake response from API. I can do testing using @testing-library/react, I can easily mock axios with axios-mock-adapter and test fetch requests using HTTP GET method. But I cannot find anywhere how to make sure that my app, when it sends some POST request, sends correct data to API, i.e. that my app sends json payload with e.g. “id” field, or “name” field set to “abc”, or something like this.

I am new to React.js. Please advise how to make tests asserting what the app sends to API. Is it possible?

Let’s say that I have a function named doSomething, like below, called with onClick of some button.

const doSomething = async (userId, something) => {
    try {
        await'doSomething', {
            user_id: userId,
            something: something
        return true;
    } catch (error) {
        return false;

REST_API above is axios instance.

How can I ensure that the I (or some other developer) didn’t make a typo and didn’t put “userId” instead of “user_id” in the payload of the request?

Source: ReactJs