hwhttp5framework
v1.0.0
Published
This library provides a simple yet powerful wrapper for making HTTP requests in JavaScript. It simplifies the process of sending requests and handling responses, making it easier to integrate HTTP functionality into your applications.
Downloads
4
Readme
httpRequestWrapper
Introduction
This library provides a simple yet powerful wrapper for making HTTP requests in JavaScript. It simplifies the process of sending requests and handling responses, making it easier to integrate HTTP functionality into your applications.
Installation
You can install httpRequestWrapper
via npm or yarn:
npm install httpRequestWrapper
or
yarn add httpRequestWrapper
Usage
const { HttpRequest } = require('httpRequestWrapper');
// Create a new instance of HttpRequest
const request = new HttpRequest();
// Set up request options
const options = {
url: 'https://api.example.com/data',
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
};
// Send the request
request.send(options)
.then(response => {
console.log('Response:', response);
})
.catch(error => {
console.error('Error:', error);
});
API
HttpRequest
Methods
send(options): Sends an HTTP request with the provided options. Returns a Promise that resolves with the response data.
License
This project is licensed under the MIT License - see the LICENSE file for details.