You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-functions/functions-bindings-http-webhook-trigger.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -189,7 +189,7 @@ This example reads the body of a POST request, as a `String`, and uses it to bui
189
189
190
190
#### Read parameter from a route
191
191
192
-
This example reads a mandatory parameter, named `id`, and an optional parameter `name` from the route path, and uses them to build a JSON document returned to the client, with content type `application/json`. T
192
+
This example reads a mandatory parameter, named `id`, and an optional parameter `name` from the route path, and uses them to build a JSON document returned to the client, with content type `application/json`.
193
193
194
194
```java
195
195
@FunctionName("TriggerStringRoute")
@@ -1004,6 +1004,12 @@ When you use route parameters, an `invoke_URL_template` is automatically created
1004
1004
1005
1005
You can programmatically access the `invoke_URL_template` by using the Azure Resource Manager APIs for [List Functions](/rest/api/appservice/webapps/listfunctions) or [Get Function](/rest/api/appservice/webapps/getfunction).
1006
1006
1007
+
::: zone pivot="programming-language-javascript,programming-language-typescript"
1008
+
### HTTP streams (preview)
1009
+
1010
+
You can now stream requests to and responses from your HTTP endpoint in Node.js v4 function apps. For more information, see [HTTP streams](functions-reference-node.md?pivots=nodejs-model-v4#http-streams-preview).
1011
+
::: zone-end
1012
+
1007
1013
### Working with client identities
1008
1014
1009
1015
If your function app is using [App Service Authentication / Authorization](../app-service/overview-authentication-authorization.md), you can view information about authenticated clients from your code. This information is available as [request headers injected by the platform](../app-service/configure-authentication-user-identities.md#access-user-claims-in-app-code).
@@ -33,8 +33,8 @@ The following table shows each version of the Node.js programming model along wi
33
33
| ---- | ---- | --- | --- | --- |
34
34
| 4.x | GA | 4.25+ | 20.x (Preview), 18.x | Supports a flexible file structure and code-centric approach to triggers and bindings. |
35
35
| 3.x | GA | 4.x | 20.x (Preview), 18.x, 16.x, 14.x | Requires a specific file structure with your triggers and bindings declared in a "function.json" file |
36
-
| 2.x |GA (EOL) | 3.x | 14.x, 12.x, 10.x | Reached end of life (EOL) on December 13, 2022. See [Functions Versions](./functions-versions.md) for more info. |
37
-
| 1.x |GA (EOL) | 2.x | 10.x, 8.x | Reached end of life (EOL) on December 13, 2022. See [Functions Versions](./functions-versions.md) for more info. |
36
+
| 2.x |n/a | 3.x | 14.x, 12.x, 10.x | Reached end of support on December 13, 2022. See [Functions Versions](./functions-versions.md) for more info. |
37
+
| 1.x |n/a | 2.x | 10.x, 8.x | Reached end of support on December 13, 2022. See [Functions Versions](./functions-versions.md) for more info. |
The `app`, `trigger`, `input`, and `output` objects exported by the `@azure/functions` module provide type-specific methods for most types. For all the types that aren't supported, a `generic` method has been provided to allow you to manually specify the configuration. The`generic` method can also be used if you want to change the default settings provided by a type-specific method.
733
+
The `app`, `trigger`, `input`, and `output` objects exported by the `@azure/functions` module provide type-specific methods for most types. For all the types that aren't supported, a `generic` method is provided to allow you to manually specify the configuration. The`generic` method can also be used if you want to change the default settings provided by a type-specific method.
734
734
735
735
The following example is a simple HTTP triggered function using generic methods instead of type-specific methods.
736
736
@@ -1222,7 +1222,7 @@ The `HttpRequest` object has the following properties:
| **`user`** | `HttpRequestUser |null` | Object representing logged-in user, either through Functions authentication, SWA Authentication, or null when no such user is logged in. |
1224
1224
| **`body`** | [`ReadableStream |null`](https://developer.mozilla.org/docs/Web/API/ReadableStream) | Body as a readable stream. |
1225
-
| **`bodyUsed`** | `boolean` | A boolean indicating if the body has been read from already. |
1225
+
| **`bodyUsed`** | `boolean` | A boolean indicating if the body is already read. |
1226
1226
1227
1227
In order to access a request or response's body, the following methods can be used:
1228
1228
@@ -1422,6 +1422,85 @@ The response can be set in several ways:
1422
1422
1423
1423
::: zone-end
1424
1424
1425
+
## HTTP streams (preview)
1426
+
1427
+
HTTP streams is a feature that makes it easier to process large data, stream OpenAI responses, deliver dynamic content, and support other core HTTP scenarios. It lets you stream requests to and responses from HTTP endpoints in your Node.js function app. Use HTTP streams in scenarios where your app requires real-time exchange and interaction between client and server over HTTP. You can also use HTTP streams to get the best performance and reliability for your apps when using HTTP.
1428
+
1429
+
HTTP streams is currently in preview.
1430
+
1431
+
::: zone pivot="nodejs-model-v3"
1432
+
>[!IMPORTANT]
1433
+
>HTTP streams aren't supported in the v3 model. [Upgrade to the v4 model](./functions-node-upgrade-v4.md) to use the HTTP streaming feature.
1434
+
::: zone-end
1435
+
::: zone pivot="nodejs-model-v4"
1436
+
The existing `HttpRequest` and `HttpResponse` types in programming model v4 already support various ways of handling the message body, including as a stream.
1437
+
1438
+
### Prerequisites
1439
+
- The [`@azure/functions` npm package](https://www.npmjs.com/package/@azure/functions) version 4.3.0 or later.
1440
+
- [Azure Functions runtime](./functions-versions.md) version 4.28 or later.
1441
+
- [Azure Functions Core Tools](./functions-run-local.md) version 4.0.5530 or a later version, which contains the correct runtime version.
1442
+
1443
+
### Enable streams
1444
+
1445
+
Use these steps to enable HTTP streams in your function app in Azure and in your local projects:
1446
+
1447
+
1. If you plan to stream large amounts of data, modify the [`FUNCTIONS_REQUEST_BODY_SIZE_LIMIT`](./functions-app-settings.md#functions_request_body_size_limit) setting in Azure. The default maximum body size allowed is `104857600`, which limits your requests to a size of ~100 MB.
1448
+
1449
+
1. For local development, also add `FUNCTIONS_REQUEST_BODY_SIZE_LIMIT` to the [local.settings.json file](./functions-develop-local.md#local-settings-file).
1450
+
1451
+
1. Add the following code to your app in any file included by your [main field](./functions-reference-node.md#registering-a-function).
1452
+
1453
+
#### [JavaScript](#tab/javascript)
1454
+
1455
+
```javascript
1456
+
const { app } =require('@azure/functions');
1457
+
1458
+
app.setup({ enableHttpStream:true });
1459
+
```
1460
+
1461
+
#### [TypeScript](#tab/typescript)
1462
+
1463
+
```typescript
1464
+
import { app } from'@azure/functions';
1465
+
1466
+
app.setup({ enableHttpStream:true });
1467
+
```
1468
+
1469
+
---
1470
+
1471
+
### Stream examples
1472
+
1473
+
This example shows an HTTP triggered function that receives data via an HTTP POST request, and the function streams this data to a specified output file:
+ The `request.params` object isn't supported when using HTTP streams during preview. Refer to this [GitHub issue](https://github.com/Azure/azure-functions-nodejs-library/issues/229) for more information and suggested workaround.
1500
+
1501
+
+ Use `request.body` to obtain the maximum benefit from using streams. You can still continue to use methods like `request.text()`, which always return the body as a string.
0 commit comments