Keq middleware for setting the request url.
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'
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'
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'
If there is any doubt, it is very welcome to discuss the issue together.