xxxxxxxxxx
<html>
<body><title>example</title>
<form action="">
<input type="button" value="post" onclick="return postForm()">
</form>
<textarea id="out" rows=25 cols=80></textarea>
<script>
function postForm() {
let opts = {"user": "vlad", "pass": "vlad pass"};
fetch('https://localhost:5001', {
method: 'post',
body: JSON.stringify(opts),
headers: {
"Content-Type": "application/json",
"Authorization": "Basic " + btoa("one:pass")
}
}).then(function (response) {
return response.json();
}).then(function (data) {
console.log('Created Gist:', data.html_url);
});
}
</script>
</body>
</html>