Skip to content

Commit

Permalink
Fix extension payload.
Browse files Browse the repository at this point in the history
Signed-off-by: Daksh Chauhan <dak-x@outlook.com>
  • Loading branch information
dak-x committed Aug 1, 2021
1 parent f6b1a1e commit 482c5fb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions kilde/postToSoke.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
// Send the entire html page to the Index Html endpoint of sokemotor.

var htmlString = toString(document.getElementsByTagName("html")[0].innerHTML)
var htmlString = document.getElementsByTagName("html")[0].innerHTML
var url = document.URL
console.log(url)

// POST method implementation:
async function postData(url = '', data = {}) {
const response = await fetch(url, {
method: 'POST', // *GET, POST, PUT, DELETE, etc.
mode: 'cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit
method: 'POST',
mode: 'cors',
cache: 'no-cache',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json'
},
redirect: 'follow', // manual, *follow, error
referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url
body: JSON.stringify(data) // body data type must match "Content-Type" header
redirect: 'follow',
referrerPolicy: 'no-referrer',
body: JSON.stringify(data)
});
return response.json(); // parses JSON response into native JavaScript objects
return response.json();
}

postData('http://localhost:8080/indexHtml', { "url" : url, "dom": htmlString})
Expand Down

0 comments on commit 482c5fb

Please sign in to comment.