serverless-offline
Version:
Emulate AWS λ and API Gateway locally when developing your Serverless project
21 lines (16 loc) • 420 B
JavaScript
const { assign } = Object
export default class HttpEventDefinition {
constructor(rawHttpEventDefinition) {
let method
let path
let rest
if (typeof rawHttpEventDefinition === "string") {
;[method, path] = rawHttpEventDefinition.split(" ")
} else {
;({ method, path, ...rest } = rawHttpEventDefinition)
}
this.method = method
this.path = path
assign(this, rest)
}
}