export type HeadApiBesluitenUuidArgs = {'If-None-Match'?: string | undefined}; export type HeadApiBesluitenUuidOptions = {baseUrl: string, JWTClaims?: string | undefined, fetch?: typeof fetch | undefined}; /** * De headers voor een specifiek(e) BESLUIT opvragen * * HEAD /besluiten/{uuid} */ export const headApiBesluitenUuid = async (args: HeadApiBesluitenUuidArgs, options: HeadApiBesluitenUuidOptions) => { const {baseUrl, fetch: fetchFn = fetch, JWTClaims} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['If-None-Match'] != null) headers.set("If-None-Match", String(args['If-None-Match'])) if (JWTClaims !== undefined) headers.set('authorization', `Bearer ${JWTClaims}`) const url = `${baseUrl.replace(/\/+$/, '')}/besluiten/${encodeURIComponent(String(args.uuid))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "HEAD", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };