fidelityHeaderfunctionfunction fidelityHeader(f: Fidelity): stringA fidelity as the value of the header: native, emulated; reason=…; risk=… or refused; reason=….
The answers: how a response is made, how the fidelity of a POSIX operation is written in X-Anyfs-Fidelity, and how an error of the POSIX view becomes a status. Every answer carries Cache-Control: no-store and X-Content-Type-Options: nosniff, and an answer made from a file carries Content-Security-Policy: sandbox, so that a browser that is pointed at the server cannot run a file as a page of the server.
import { fidelityHeader } from "./respond.ts";
fidelityHeader({ kind: "native" }); // "native"fidelityHeaderfunctionfunction fidelityHeader(f: Fidelity): stringA fidelity as the value of the header: native, emulated; reason=…; risk=… or refused; reason=….
Answertypeno test imports ittype Answer = {
readonly status: Status;
readonly headers?: Readonly<Record<string, string>>;
readonly body?: Uint8Array | string | undefined;
readonly fidelity?: Fidelity;
/** The answer shows the content of a file. */
readonly file?: boolean;
};What an answer is made from.
responseOffunctionfunction responseOf(a: Answer): ResponseThe response of an answer.
xmlAnswerfunctionno test imports itfunction xmlAnswer(status: 200 | 201 | 204 | 206 | 207 | 304 | 400 | 401 | 403 | 404 | 405 | 409 | 412 | 413 | 414 | 415 | 416 | 423 | 424 | 500 | 501 | 502 | 503, root: XmlElement, extra?: Readonly<Record<string, string>>, fidelity?: Fidelity | undefined): AnswerAn answer whose body is XML.
textAnswerfunctionno test imports itfunction textAnswer(status: 200 | 201 | 204 | 206 | 207 | 304 | 400 | 401 | 403 | 404 | 405 | 409 | 412 | 413 | 414 | 415 | 416 | 423 | 424 | 500 | 501 | 502 | 503, message: string, headers?: Readonly<Record<string, string>>, fidelity?: Fidelity | undefined): AnswerA plain answer that says what went wrong in a sentence.
errorAnswerfunctionfunction errorAnswer(e: PosixError, context: Context): AnswerThe answer to an error of the POSIX view: the status of its code in the context, or 503 with a wait where the store is not there now, or 502 where what it holds is not what it says.