flea-http
Version:
easy pure javascript xhr rest module with header injector
22 lines (21 loc) • 627 B
HTML
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<script src="../flea.js"></script>
<title>Document</title>
</head>
<body></body>
<script>
var myHeaders = [{ Flip: "text/xml" }, { Flop: "text/xml" }];
flea("https://httpbin.org/get", "GET", myHeaders)
.then(function(o) {
console.log(JSON.parse(o.response));
})
.catch(function(error) {
console.error("Something went wrong", error);
});
</script>
</html>