0.0.45 • Published 2 months ago

@hattip/cors v0.0.45

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@hattip/cors

Cross-Origin Resource Sharing(CORS) middleware for Hattip.

Options

export interface CorsOptions {
  /** `Access-Control-Allow-Origin`, default is request Origin header  */
  origin?:
    | string
    | ((ctx: RequestContext) => string | false | Promise<string | false>);
  /** `Access-Control-Allow-Methods`, default is 'GET,HEAD,PUT,POST,DELETE,PATCH'  */
  allowMethods?: string | string[] | null;
  /** `Access-Control-Expose-Headers`  */
  exposeHeaders?: string | string[];
  /** `Access-Control-Allow-Headers`  */
  allowHeaders?: string | string[];
  /** `Access-Control-Max-Age` in seconds  */
  maxAge?: string | number;
  /** `Access-Control-Allow-Credentials`  */
  credentials?: boolean | ((ctx: RequestContext) => boolean | Promise<boolean>);
  /**
   * `Cross-Origin-Opener-Policy` & `Cross-Origin-Embedder-Policy` headers.',
   * default is false
   *
   * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/Planned_changes
   */
  secureContext?: boolean;
  /**
   * Handle `Access-Control-Request-Private-Network` request by return `Access-Control-Allow-Private-Network`, default to false
   * @see https://wicg.github.io/private-network-access/
   */
  privateNetworkAccess?: boolean;
}

License

0.0.45

2 months ago

0.0.44

2 months ago

0.0.43

3 months ago

0.0.42

3 months ago

0.0.41

4 months ago

0.0.40

4 months ago

0.0.39

4 months ago

0.0.38

4 months ago

0.0.37

5 months ago

0.0.36

5 months ago

0.0.35-canary.2

10 months ago

0.0.35-canary.7

9 months ago

0.0.35-canary

10 months ago

0.0.35

8 months ago

0.0.34

12 months ago

0.0.33

1 year ago

0.0.30

1 year ago

0.0.31

1 year ago

0.0.32

1 year ago

0.0.28

1 year ago

0.0.29

1 year ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.23

1 year ago

0.0.24

1 year ago

0.0.25

1 year ago

0.0.26

1 year ago

0.0.27

1 year ago

0.0.20

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago