const obj = { hello: "world" };
const myBlob = new Blob([JSON.stringify(obj, null, 2)], {
type: "application/json",
});
const request = new Request("/myEndpoint", {
method: "POST",
body: myBlob,
});
request.blob().then((myBlob) => {
// do something with the blob sent in the request
});Request: blob() method / notebook
Request: blob() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.