New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

kefir-fetch

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kefir-fetch

[Kefir](https://github.com/rpominov/kefir) wrapper around [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) with JSON-friendly defaults

  • 0.1.15
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Weekly downloads
 
Created
Source

kefir-fetch

Kefir wrapper around fetch with JSON-friendly defaults

Installation

npm install kefir-fetch

Usage

fetch$(method, path, options?)

The optional options argument may include:

  • body: JSON request body
  • query: JSON query object, which is encoded and appended to the URL
  • headers: Override HTTP headers, which by default are:
    • "Accept": "application/json"
    • "Content-Type": "application/json"
  • base_url: Base URL to prepend path to, useful for non-web apps

Default options

fetch$.setDefaultOptions(options)

To override the default options for all requests, use setDefaultOptions.

Examples

fetch$ = require 'kefir-fetch'

# Get an item

fetch$('get', '/item/55.json').onValue (item) ->
    console.log "Got item:", item

# Update some item, using the body option

update = {score: 0.43}

fetch$('put', '/items/55.json', {body: update}).onValue (updated) ->
    console.log "Updated item:", updated

# Search for some items, using the query option

search = {q: "some"}

fetch$('get', '/items.json', {query: search}).onValue (items) ->
    console.log "Found items:", items

Keywords

FAQs

Package last updated on 06 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc