{"size": 984, "ext": "js", "max_stars_repo_path": "src/easyhttpawait/easyhttpawait.js", "max_stars_repo_name": "mbronshteyn/javascript", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/easyhttpawait/easyhttpawait.js", "max_issues_repo_name": "mbronshteyn/javascript", "max_issues_repo_issues_event_min_datetime": "2020-07-16T19:27:13.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T10:03:17.000Z", "max_forks_repo_path": "src/easyhttpawait/easyhttpawait.js", "max_forks_repo_name": "mbronshteyn/javascript", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 7, "max_forks_count": null, "avg_line_length": 17.8909090909, "max_line_length": 81, "alphanum_fraction": 0.5599593496}
/**
 * EasyHttp class
 */
class EasyHttp{

  // Make HTTP Get
  async get( url ){

    const response = await fetch( 'https://jsonplaceholder.typicode.com/users' );
    return await response.json();
  }

  // Make HTTP Post
  async post(url, data) {

    const response = await fetch(url, {
      method: 'POST',
      headers: {
        'Content-type': 'application/json'
      },
      body: JSON.stringify(data)
    });

    let resData =  await response.json();

    return resData;
  }

  // Make HTTP Put
  async put(url, data) {
    const response = await fetch(url, {
        method: 'PUT',
        headers: {
          'Content-type': 'application/json'
        },
        body: JSON.stringify(data)
      });

    let resData = await response.json();

    return resData;
  }

  // Make HTTP DELETE
  async delete( url ) {
      const response = await fetch(url, {
        method: 'DELETE',
      });

      let resData = await response.status;

      return resData;
  }
}
