Skip to content

Commit 3ffa436

Browse files
Moved annotation Express.Request.rawBody to index
1 parent 78ba5c1 commit 3ffa436

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,16 @@ export {http, cloudevent} from './function_registry';
2828

2929
// Call the main method to load the user code and start the http server.
3030
main();
31+
32+
// We annotate the express Request with a rawBody field.
33+
// Express leaves the Express namespace open to allow merging of new fields.
34+
declare global {
35+
namespace Express {
36+
export interface Request {
37+
/**
38+
* A buffer which contains the request's raw HTTP body.
39+
*/
40+
rawBody?: Buffer;
41+
}
42+
}
43+
}

src/invoker.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,6 @@ import * as http from 'http';
2424
import {FUNCTION_STATUS_HEADER_FIELD} from './types';
2525
import {sendCrashResponse} from './logger';
2626

27-
// We optionally annotate the express Request with a rawBody field.
28-
// Express leaves the Express namespace open to allow merging of new fields.
29-
declare global {
30-
// eslint-disable-next-line @typescript-eslint/no-namespace
31-
namespace Express {
32-
export interface Request {
33-
rawBody?: Buffer;
34-
}
35-
}
36-
}
37-
3827
/**
3928
* Response object for the most recent request.
4029
* Used for sending errors to the user.

0 commit comments

Comments
 (0)