Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cloud_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import * as express from 'express';
import {CloudEvent} from './functions';

/**
* Custom exception class to represent errors durring event conversions.
* Custom exception class to represent errors during event conversions.
*/
export class EventConversionError extends Error {}

Expand Down Expand Up @@ -62,7 +62,7 @@ export function getBinaryCloudEventContext(
const context = {} as CloudEvent<unknown>;
for (const name in req.headers) {
if (name.startsWith('ce-')) {
const attributeName = name.substr(
const attributeName = name.substring(
'ce-'.length,
) as keyof CloudEvent<unknown>;
context[attributeName] = req.header(name);
Expand Down
12 changes: 6 additions & 6 deletions src/function_wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const parseCloudEventRequest = (req: Request): CloudEvent<unknown> => {
* Helper function to background event context and data payload object from an HTTP
* request.
* @param req - An Express HTTP request
* @returns The data playload and event context parsed from the request
* @returns The data payload and event context parsed from the request
*/
const parseBackgroundEvent = (req: Request): {data: {}; context: Context} => {
const event = req.body;
Expand Down Expand Up @@ -130,7 +130,7 @@ const wrapHttpFunction = (execute: HttpFunction): RequestHandler => {
/**
* Wraps an async CloudEvent function in an express RequestHandler.
* @param userFunction - User's function
* @return An Express hander function that invokes the user function
* @return An Express handler function that invokes the user function
*/
const wrapCloudEventFunction = (
userFunction: CloudEventFunction,
Expand All @@ -151,7 +151,7 @@ const wrapCloudEventFunction = (
/**
* Wraps callback style CloudEvent function in an express RequestHandler.
* @param userFunction - User's function
* @return An Express hander function that invokes the user function
* @return An Express handler function that invokes the user function
*/
const wrapCloudEventFunctionWithCallback = (
userFunction: CloudEventFunctionWithCallback,
Expand All @@ -167,7 +167,7 @@ const wrapCloudEventFunctionWithCallback = (
/**
* Wraps an async event function in an express RequestHandler.
* @param userFunction - User's function
* @return An Express hander function that invokes the user function
* @return An Express handler function that invokes the user function
*/
const wrapEventFunction = (userFunction: EventFunction): RequestHandler => {
const httpHandler = (req: Request, res: Response) => {
Expand All @@ -186,7 +186,7 @@ const wrapEventFunction = (userFunction: EventFunction): RequestHandler => {
/**
* Wraps a callback style event function in an express RequestHandler.
* @param userFunction - User's function
* @return An Express hander function that invokes the user function
* @return An Express handler function that invokes the user function
*/
const wrapEventFunctionWithCallback = (
userFunction: EventFunctionWithCallback,
Expand All @@ -203,7 +203,7 @@ const wrapEventFunctionWithCallback = (
* Wraps a user function with the provided signature type in an express
* RequestHandler.
* @param userFunction User's function.
* @return An Express hander function that invokes the user function.
* @return An Express handler function that invokes the user function.
*/
export const wrapUserFunction = <T = unknown>(
userFunction: HandlerFunction<T>,
Expand Down
Loading