getRequestKey
A function that implements the default algorithm of generating a request key.
import { getRequestKey } from 'bestfetch';
options
(object): An object that contains information about a request.url
: The URL of the request.method
: The HTTP method of the request.body
: The body
option of the request.responseType
: The responseType
option of the request.A string
that is the request key.
const requestKey = getRequestKey({
url: '/api/books/2',
method: 'POST',
body: '{}',
responseType: 'json'
});
console.log('The request key is:', requestKey);
Keep in mind that bestfetch automatically generates request keys for you, so it's very unlikely that you will ever need to call this function directly.