0.4.5 • Published 9 years ago

clay-request v0.4.5

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

TODO: compile to js, and tests, and docs

simple window.fetch wrapper

request = require 'clay-request'

# Automatic json extraction
request '/get'
.then (json) ->
  # parsed json

request '/post', {method: 'POST'}
.then (json) ->
  # parsed json

# Query string object support
request '/getQs', {qs: {a: 2}} # /getQs?a=2
.then (json) ->
  # parsed json

# Errors trigger promise failure
request '/404'
.catch (err) ->
  # RequestError object
  err.res.json().then -> # handle error

# RequestError
class RequestError extends Error
  constructor: ({res}) ->
    @name = 'RequestError'
    @message = res.statusText
    @stack = (new Error()).stack
    @res = res
0.4.5

9 years ago

0.4.4

10 years ago

0.4.3

10 years ago

0.4.2

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago