4chan-full
Version:
www.4chan.org non-official read only api. That supports cool things!
16 lines (13 loc) • 393 B
JavaScript
const got = require("got").default;
/**
* @param {"GET"|"POST"} method
* @param {String} url
* @param {Object} headers
*
* @returns {Promise<String>}
*/
async function defaultRequest(method, url, headers) {
let response = await got(url, { method, headers, responseType: "text", throwHttpErrors: false });
return response.body;
}
module.exports = { defaultRequest };