Parameters object
Optionalheaders?: Record<string, string>Headers for the request
Optionalmethod?: HttpMethodThe HTTP method (default: 'GET')
Optionalpayload?: objectRequest payload (only for POST/PUT)
Request URL
Resolves with an HTTP response serialized to a plain object
Send an HTTP request to a URL.
For POST or PUT requests, an optional payload can be sent as the body.
The "Content-Type" is inferred from the payload type and can be overridden via the
headersargument.If the body is not a type natively accepted by the Fetch API, it is serialized to a string:
JSON.stringify()for objects, orString()for primitives.