Function
buildProjectsUrl
(
page: number,
delayMs: number,
forceError: boolean,
)
Source from the content-addressed store, hash-verified
| 47 | const API_BASE_URL = `http://127.0.0.1:${API_PORT}` |
| 48 | |
| 49 | function buildProjectsUrl( |
| 50 | page: number, |
| 51 | delayMs: number, |
| 52 | forceError: boolean, |
| 53 | ): URL { |
| 54 | const url = new URL('/api/projects', API_BASE_URL) |
| 55 | url.searchParams.set('page', String(page)) |
| 56 | |
| 57 | if (delayMs > 0) { |
| 58 | url.searchParams.set('delay', String(delayMs)) |
| 59 | } |
| 60 | |
| 61 | if (forceError) { |
| 62 | url.searchParams.set('error', 'true') |
| 63 | } |
| 64 | |
| 65 | return url |
| 66 | } |
| 67 | |
| 68 | async function readJsonOrThrow<T>( |
| 69 | response: Response, |
Tested by
no test coverage detected