-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetch.html
More file actions
31 lines (27 loc) · 821 Bytes
/
fetch.html
File metadata and controls
31 lines (27 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="node_modules/node-fetch/fetch.js"></script>
</head>
<body>
<p id='response'></p>
<script>
var result = fetch('https://dev.ralali.com:1027/api/v1/shippings?addressId=5969', {
headers: {
'Authorization': 'Bearer put_token_here'
}
})
result.then(function (response) {
console.log('response', response)
console.log('header', response.headers.get('Content-Type'))
return response.text()
}).then(function (text) {
console.log('got text', text)
document.getElementById("response").innerHTML = text;
}).catch(function (ex) {
console.log('failed', ex)
})
</script>
</body>
</html>