Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@equinor/fusion-framework-module-http

Package Overview
Dependencies
Maintainers
3
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@equinor/fusion-framework-module-http

Module for configuring and providing http clients

  • 2.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3K
increased by42.11%
Maintainers
3
Weekly downloads
 
Created
Source

Configure

Module for configuring and providing http clients

Simple

const configure = (config) => {
  config.http.configureClient(
      'bar', 
      'https://somewhere-test.com'
    );
}

Standard

const configure = (config) => {
  config.http.configureClient(
      'bar', 
      {
        baseUri: 'https://foo.bar',
        defaultScopes: ['foobar/.default']
      }
    );
}

Callback

const configure = async(config) => {
  config.http.configureClient(
      'bar',
      (client): => {
        client.uri = 'https://foo.bar'
        client.defaultScopes: ['foobar/.default']
      }
    );
}

Consumption

const client = modules.http.createClient('foo');
const selector = (response: Response): Promise<FooBar> => response.json(); 
// stream
client.fetch('/api/admin', {selector, scopes: ['foobar/.admin']}).subscribe(x => console.log(x));
// async
client.fetchAsync('/api', {selector}).then(console.log);

Operators

const client = modules.http.createClient('foo');
const logger = console.debug;
client.requestHandler.add((x: Request) => logger(x));
client.responseHandler.add((x: Request) => logger(x));

FAQs

Package last updated on 17 Jan 2023

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