4.0.0 • Published 2 years ago

@zthun/works.http v4.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Description

A library that includes a real and a mockable http service to assist with testing and rest invocations.

Installation

# NPM
npm install @zthun/works.http
# Yarn
yarn add @zthun/works.http

Usage

import { ZRequestBuilder, ZHttpService } from '@zthun/works.url';

function getImage(): string[] {
  const service: IZHttpService = new ZHttpService();
  const request = new ZRequestBuilder();

  return [
    // Create urls from scratch
    // Outputs: ftp://zthunworks.com:3662/path/to/resource/?foo=bar&name=joe/#/home
    new ZUrlBuilder().protocol('ftp').host('zthunworks.com').path('/path/to').append('resource').port(3662).param('foo', 'bar').param('name', 'joe').hash('home').build(),

    // Create urls based on the current browser location.
    // Outputs: https://zthunworks.com/#/home
    new ZUrlBuilder().location().build(),

    // Creates urls based on the location and a base path for your server api
    // Outputs: https://zthunworks.com/api
    new ZUrlBuilder().api().build(),
    // Outputs: https://zthunworks.com/server
    new ZUrlBuilder().api(location, 'server').build(),

    // Parse existing urls and add subdomains to it.
    // https://coffee.zthunworks.com/#/login
    new ZUrlBuilder().parse('https://zthunworks.com/#/login').subdomain('coffee').build()
  ];
}
4.0.0

2 years ago

3.0.2

2 years ago

3.1.0

2 years ago

3.0.0

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.2.0

3 years ago

1.1.0

3 years ago