Skip to main content

HTTP Module of camouflage mocking lib. Used to create mocks based on http/https/http2 protocols

This package works with Node.js
This package works with Node.js
JSR Score
58%
Published
4 months ago (0.1.3)
class CamouflageHttp

Constructors

new
CamouflageHttp(
httpOptions?: http.ServerOptions,
httpsOptions?: https.ServerOptions,
cacheOptions?: apicache.Options,
corsOptions?: cors.CorsOptions | cors.CorsOptionsDelegate<Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>>,
)

Properties

addHook: (
route: string,
event:
"onRequest"
| "beforeResponse"
| "afterResponse"
,
) => void
getHelpers: () => Helpers
loadConfigFromJson: (configFilePath: string) => void
setServerOptionsHttp: (options: http.ServerOptions) => void
setServerOptionsHttp2: (options: spdy.server.ServerOptions) => void
setServerOptionsHttps: (options: https.ServerOptions) => void
setupCacheWithOptions: (options: apicache.Options) => void
setupCompressionWithOptions: (compressionOpts: CompressionOptions) => void
setupCorsWithOptions: (corsOptions: cors.CorsOptions | cors.CorsOptionsDelegate<Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>>) => void
setupValidationWithOptions: (validationOpts: any) => void
private
app: express.Application | null
private
cacheOptions: apicache.Options | null
private
compressionOpts: CompressionOptions | null
private
corsOptions:
cors.CorsOptions
| cors.CorsOptionsDelegate<Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>>
| null
private
helpers: Helpers
private
hooks: Hooks
private
http2Server: Server | null
private
http2ServerOptions: spdy.server.ServerOptions | null
private
httpServer: Server | null
private
httpServerOptions: http.ServerOptions | null
private
httpsServer: Server | null
private
httpsServerOptions: https.ServerOptions | null
private
validationOpts: any | null

Methods

Add Package

npx jsr add @camouflage/http

Import symbol

import module from "@camouflage/http";

Add Package

yarn dlx jsr add @camouflage/http

Import symbol

import module from "@camouflage/http";

Add Package

pnpm dlx jsr add @camouflage/http

Import symbol

import module from "@camouflage/http";