JSFiddle - React, Tailwind, and code Playground

by zerippe

JavaScript

const params = {
  "hub.mode": "publish",
  "hub.url": "https://gazee.net/atom.xml"
};
const method = "POST";
const body = Object.keys(params).map((key)=>key+"="+encodeURIComponent(params[key])).join("&");
const headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
};

fetch("https://pubsubhubbub.appspot.com/publish", {method, headers, body})
  .then((res)=> res.json())
  .then(console.log)
  .catch(console.error);