UNPKG

916 BPlain TextView Raw
1/**
2 * -------------------------------------------------------------------------------------------
3 * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
4 * See License in the project root for license information.
5 * -------------------------------------------------------------------------------------------
6 */
7
8/**
9 * @module HTTPMessageHandler
10 */
11
12import { Context } from "../IContext";
13import { Middleware } from "./IMiddleware";
14
15/**
16 * @class
17 * @implements Middleware
18 * Class for HTTPMessageHandler
19 */
20export class HTTPMessageHandler implements Middleware {
21 /**
22 * @public
23 * @async
24 * To execute the current middleware
25 * @param {Context} context - The request context object
26 * @returns A promise that resolves to nothing
27 */
28 public async execute(context: Context): Promise<void> {
29 context.response = await fetch(context.request, context.options);
30 }
31}