The type of the request body.
The URL to send the POST request to.
The body of the POST request.
Optional
token: stringOptional token to be included in the Authorization header.
Optional
The response from the POST request.
const response = await sendPost<{ name: string }>('https://api.example.com/users', { name: 'Alice' }, 'mytoken123');
const data = await response.json();
console.log(data);
Will throw an error if the POST request fails, including the failed request body.
Generated using TypeDoc
Sends a POST request to a specified URL with a given body and Bearer Token. Content-Type is set to application/json.