(accountId, apiKey, accountEmail)
| 29 | * @param {string | undefined} accountEmail Cloudflare account email |
| 30 | */ |
| 31 | export async function getWorkersDevSubdomain(accountId, apiKey, accountEmail) { |
| 32 | const response = await fetch( |
| 33 | `${apiBase}/accounts/${accountId}/workers/subdomain`, |
| 34 | { |
| 35 | headers: buildAuthHeaders(apiKey, accountEmail) |
| 36 | } |
| 37 | ); |
| 38 | if (!response.ok) { |
| 39 | throw new Error( |
| 40 | `GET worker subdomain failed.\n${response.status}: ${ |
| 41 | response.statusText |
| 42 | }\n${await response.text()}` |
| 43 | ); |
| 44 | } |
| 45 | /** @type {{ result: { subdomain: string; }; }} */ |
| 46 | const data = await response.json(); |
| 47 | return data.result.subdomain; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * @typedef {object} DeployToWorkersDevArgs |
no test coverage detected