JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4643
  • Score
    100M100P100Q131171F
  • License MIT

Set request url

Package Exports

  • keq-url
  • keq-url/dist/esm/src/index.js
  • keq-url/dist/umd/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (keq-url) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

keq-url

version downloads license dependencies Codecov

Keq middleware for setting the request url.

Usage

setBaseUrl(baseUrl)

import { request } from "keq";
import { setBaseUrl, setHost } from "keq-url";

request.use(setBaseUrl("http://example.com/api"));

await request.get("/test");
// it will send request to 'http://example.com/api/test'

setOrigin(origin)

import { request } from "keq";
import { setOrigin } from "keq-url";

request.use(setOrigin("http://example.com:8080"));

await request.get("http://test.com/test");
// it will send request to 'http://example.com:8080/test'

setHost(host)

import { request } from "keq";
import { setHost } from "keq-url";

request.use(setHost("example.com"));

await request.get("http://test.com/test");
// it will send request to 'http://example.com/test'

Contributing & Development

If there is any doubt, it is very welcome to discuss the issue together.