@faasjs/http

License: MITopen in new windowNPM Stable Versionopen in new windowNPM Beta Versionopen in new window

FaasJS's http plugin.

Install

npm install @faasjs/http

Modules

Classes

Type Aliases

Variables

Functions

Type Aliases

CookieOptions

Ƭ CookieOptions: Object

Index signature

▪ [key: string]: any

Type declaration

NameType
domain?string
expires?number
httpOnly?boolean
path?string
sameSite?"Strict" | "Lax" | "None"
secure?boolean
session?SessionOptions

HttpConfig

Ƭ HttpConfig<TParams, TCookie, TSession>: Object

Type parameters

NameType
TParamsextends Record<string, any> = any
TCookieextends Record<string, string> = any
TSessionextends Record<string, string> = any

Index signature

▪ [key: string]: any

Type declaration

NameType
config?{ [key: string]: any; cookie?: CookieOptions ; functionName?: string ; ignorePathPrefix?: string ; method?: "BEGIN" | "GET" | "POST" | "DELETE" | "HEAD" | "PUT" | "OPTIONS" | "TRACE" | "PATCH" | "ANY" ; path?: string ; timeout?: number }
config.cookie?CookieOptions
config.functionName?string
config.ignorePathPrefix?string
config.method?"BEGIN" | "GET" | "POST" | "DELETE" | "HEAD" | "PUT" | "OPTIONS" | "TRACE" | "PATCH" | "ANY"
config.path?string
config.timeout?number
name?string
validator?ValidatorConfig<TParams, TCookie, TSession>

Response

Ƭ Response: Object

Type declaration

NameType
body?string
headers?{ [key: string]: string; }
message?string
statusCode?number

SessionOptions

Ƭ SessionOptions: Object

Type declaration

NameType
cipherName?string
digest?string
iterations?number
keystring
keylen?number
salt?string
secretstring
signedSalt?string

ValidatorConfig

Ƭ ValidatorConfig<TParams, TCookie, TSession>: Object

Type parameters

NameType
TParamsextends Record<string, any> = any
TCookieextends Record<string, string> = any
TSessionextends Record<string, string> = any

Type declaration

NameType
before?BeforeOption
cookie?ValidatorOptions<TCookie>
params?ValidatorOptions<TParams>
session?ValidatorOptions<TSession>

ValidatorOptions

Ƭ ValidatorOptions<Content>: Object

Type parameters

NameType
ContentRecord<string, any>

Type declaration

NameType
onError?(type: string, key: string | string[], value?: any) => { message: any ; statusCode?: number } | void
rules{ [k in keyof Content]?: ValidatorRuleOptions }
whitelist?"error" | "ignore"

ValidatorRuleOptions

Ƭ ValidatorRuleOptions: Object

Type declaration

NameType
config?Partial<ValidatorOptions>
default?any
in?any[]
regexp?RegExp
required?boolean
type?ValidatorRuleOptionsType

Variables

ContentType

Const ContentType: Object

Index signature

▪ [key: string]: string

Functions

useHttp

useHttp<TParams, TCookie, TSession>(config?): UseifyPlugin<Http<TParams, TCookie, TSession>>

Type parameters

NameType
TParamsextends Record<string, any> = any
TCookieextends Record<string, string> = any
TSessionextends Record<string, string> = any

Parameters

NameType
config?HttpConfig<TParams, TCookie, TSession>

Returns

UseifyPlugin<Http<TParams, TCookie, TSession>>