Skip to main content

Input

  • Type : string | URL | Request

  • when you try to fetch any request with http-pro, first argument it will acceept is url. url can be one of the following type.

    1. string. it can be absoulte URL or relative URL if you are working with baseURL.
    2. javascript URL object.
    3. javascript Request object.

  • Example

const res = await hp.get('https://www.x.com/api/users');
console.log(res.data); // list of users
const url = new URL('https://www.x.com/api/users');
const res = await hp.get(url);
console.log(res.data); // list of users
const request = new Request('https://www.x.com/api/users');
const res = await hp.get(request);
console.log(res.data); // list of users