Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/xcto_middleware/mod.ts>xcto

HTTP XCTO(X-Content-Type-Options) middleware
Latest
function xcto
import { xcto } from "https://deno.land/x/xcto_middleware@1.0.0/mod.ts";

Create X-Content-Type-Options header middleware.

Add X-Content-Type-Options header field to Response.

X-Content-Type-Options: nosniff

Examples

Example 1

import {
  type Handler,
  xcto,
} from "https://deno.land/x/xcto_middleware@$VERSION/mod.ts";
import { assert } from "https://deno.land/std/testing/asserts.ts";

declare const request: Request;
declare const handler: Handler;

const middleware = xcto();
const response = await middleware(request, handler);

assert(response.headers.has("x-content-type-options"));