@dcos/http-service

2.3.2Β β€’Β PublicΒ β€’Β Published

HTTP Service Build Status


πŸ‘©β€πŸ”¬ Please be aware that this package is still experimental β€” changes to the interface and underlying implementation are likely, and future development or maintenance is not guaranteed.


This package wraps connections managed by the @dcos/connection-manager package into an Observable.

Usage

import { request, stream } from "@dcos/http-service";

request("http://localhost:4200/payload.json")
  .retry(3)
  .subscribe({
    next: ({ code, message, response }) => console.log(code, message, response),
    error: ({ code, message, response }) => console.error(code, message, response),
    complete: () => console.log("complete")
  });

stream("http://localhost:4200/mesos/api/v1", {
  method: "POST",
  responseType: "text",
  body: JSON.stringify({ type: "SUBSCRIBE" }),
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json"
  }
})
  .subscribe({
    next: data => console.log(data),
    error: event => console.log(event),
    complete: () => console.log("complete")
  });

Readme

Keywords

none

Package Sidebar

Install

npm i @dcos/http-service

Weekly Downloads

1

Version

2.3.2

License

Apache-2.0

Unpacked Size

216 kB

Total Files

20

Last publish

Collaborators

  • vacas5
  • mesosphere-frontend-ci
  • mesosphere-it
  • juliangieseke