JSPM

  • Created
  • Published
  • Downloads 7813
  • Score
    100M100P100Q33062F
  • License MIT

It's like superagent but without all the shitcode and shitdeps.

Package Exports

  • snekfetch

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (snekfetch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

snekfetch

Just do http requests without all that weird nastiness from other libs

response.text is raw and always present
response.body will be a buffer or an object and is not always present

you can end or then or catch a request just like superagent. you can probably await it as well <.<

const snekfetch = require('snekfetch');

snekfetch.get('https://s.gus.host/o-SNAKES-80.jpg')
  .then(r => fs.writeFile('download.jpg', r.body));
const snekfetch = require('snekfetch');

snekfetch.post('https://httpbin.org/post')
  .send({ meme: 'dream' })
  .then(r => console.log(r.body));

// if you are a complete meme and hate humanity
const r = snekfetch.postSync('https://httpbin.org/post', {
  body: { meme: 'dream' }
});

console.log(r.body);