parseRequestInputTarget(text: string): { verb: string | null; url: string; }
A [verb:]url argument, split.
post:/api/users is a POST to /api/users; /api/users is whichever verb the caller means by
no verb at all. Only the five verbs that have commands count as a prefix, which is what keeps
http://x and localhost:3000/x from being read as one — neither http nor localhost is a
verb.
import { parseRequestInputTarget } from './http-service.ts'; parseRequestInputTarget('post:/api/users'); // { verb: 'POST', url: '/api/users' } parseRequestInputTarget('localhost:3000/x'); // { verb: null, url: 'localhost:3000/x' } parseRequestInputTarget('https://x/y'); // { verb: null, url: 'https://x/y' }