Skip to content

Commit b0ba713

Browse files
authored
Add HttpRequest.get method to types (#10)
1 parent 949472a commit b0ba713

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

test/types/index.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const runHttp: AzureFunction = async function (context: Context, req: HttpReques
2222
context.log("This is a 'GET' method");
2323
}
2424

25+
context.log(`Header: ${req.get('X-CUSTOM-HEADER')}`);
2526
context.log('JavaScript HTTP trigger function processed a request.');
2627
if (req.query.name || (req.body && req.body.name)) {
2728
context.res = {

types/http.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ export interface HttpRequest {
108108
*/
109109
bufferBody?: Buffer;
110110

111+
/**
112+
* Get the value of a particular header field
113+
*/
114+
get(field: string): string | undefined;
115+
111116
/**
112117
* Parses the body and returns an object representing a form
113118
* @throws if the content type is not "multipart/form-data" or "application/x-www-form-urlencoded"

0 commit comments

Comments
 (0)