funcool/rxhttp

Name: rxhttp

Owner: funcool

Description: A reactive streams based http client for ClojureScript

Created: 2017-11-19 10:14:46.0

Updated: 2018-02-07 20:14:19.0

Pushed: 2017-12-20 15:02:06.0

Homepage: null

Size: 23

Language: Clojure

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

rxhttp

Clojars Project

Introduction

A stream based http client for Clojure and ClojureScript that works in browser, nodejs and JVM; and uses beicon as reactive streams abstraction.

Installation

Add the following dependency into your project.clj file:

cool/rxhttp "1.0.0"]
Getting started

This library just consists in one public namespace with one public method:

uire '[rxhttp.core :as http]
     '[beicon.core :as rx])

(http/send! {:method :get :url "https://httpbin.org/get"})
(rx/subscribe (fn [{:keys [status headers body] :as response}]
                (println "Response:" response))))

That's it, nothing more. You can see all available options in the send! function docstring.

On JVM platform you also have a send!! function, that is a synchronous variant of send!.

How to contribute?

Just open an issue if you found an error or unexpected behavior or if you want discuss some additional feature. If you found some unexpected behavior and you have time to fix it, please open a PR!

FAQ

Because I need and want to handle the response with reactive streams and that abstraction allows easy way to abort/cancel a ingoing request. A promise based solutions does allow that because promise abstracion is not cancellable.

This library does not intend to reinvent the wheel, it just the well established libraries under the hood and exposes an uniform api for all platforms..

Yes. Reactive-Streams provide a better abstraction for represent an asynchronous result; they are cancellable and lazy.

License

rxhttp is licensed under MPL-2.0 license.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.