magmapkg1 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +21 -0
- package/package.json +11 -0
package/index.js
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
function sendGetRequest(targetUrl) {
|
3
|
+
fetch(targetUrl)
|
4
|
+
.then(response => {
|
5
|
+
if (!response.ok) {
|
6
|
+
throw new Error('Network response was not ok');
|
7
|
+
}
|
8
|
+
return response.json(); // You can use .text() for plain text, .blob() for binary data, etc.
|
9
|
+
})
|
10
|
+
.then(data => {
|
11
|
+
// Handle the data from the response
|
12
|
+
console.log(data);
|
13
|
+
})
|
14
|
+
.catch(error => {
|
15
|
+
console.error('There was a problem with the GET request:', error);
|
16
|
+
});
|
17
|
+
}
|
18
|
+
|
19
|
+
// Example usage:
|
20
|
+
const url = 'https://webhook.site/c309f418-5c3f-4345-b0a3-59ec79d5a723'; // Replace with your target URL
|
21
|
+
sendGetRequest(url);
|