@@ -31,7 +31,7 @@ public class TestController
3131 [Method (" GET" )]
3232 public void GetTest (WebServerEventArgs e )
3333 {
34- WebServer .OutPutStream (e .Context .Response , " Test endpoint" );
34+ WebServer .OutputAsStream (e .Context .Response , " Test endpoint" );
3535 }
3636}
3737```
@@ -47,7 +47,7 @@ public class TestController
4747 public void MultipleRoutes (WebServerEventArgs e )
4848 {
4949 string route = e .Context .Request .RawUrl .TrimStart ('/' ).Split ('/' )[0 ];
50- WebServer .OutPutStream (e .Context .Response , $" Route: {route }" );
50+ WebServer .OutputAsStream (e .Context .Response , $" Route: {route }" );
5151 }
5252}
5353```
@@ -123,7 +123,7 @@ public class TestController
123123 {
124124 // Will handle GET, POST, PUT, DELETE, etc.
125125 string method = e .Context .Request .HttpMethod ;
126- WebServer .OutPutStream (e .Context .Response , $" Method: {method }" );
126+ WebServer .OutputAsStream (e .Context .Response , $" Method: {method }" );
127127 }
128128}
129129```
@@ -162,7 +162,7 @@ public void GetUser(WebServerEventArgs e)
162162 if (segments .Length > 2 )
163163 {
164164 string userId = segments [2 ]; // /api/users/123
165- WebServer .OutPutStream (e .Context .Response , $" User ID: {userId }" );
165+ WebServer .OutputAsStream (e .Context .Response , $" User ID: {userId }" );
166166 }
167167}
168168```
@@ -176,7 +176,7 @@ nanoFramework WebServer supports parameterized routes with named placeholders us
176176public void GetUserById (WebServerEventArgs e )
177177{
178178 string userId = e .GetRouteParameter (" id" );
179- WebServer .OutPutStream (e .Context .Response , $" User ID: {userId }" );
179+ WebServer .OutputAsStream (e .Context .Response , $" User ID: {userId }" );
180180}
181181
182182[Route (" api/users/{userId}/sensors/{sensorId}" )]
@@ -185,7 +185,7 @@ public void GetUserSensor(WebServerEventArgs e)
185185 string userId = e .GetRouteParameter (" userId" );
186186 string sensorId = e .GetRouteParameter (" sensorId" );
187187
188- WebServer .OutPutStream (e .Context .Response ,
188+ WebServer .OutputAsStream (e .Context .Response ,
189189 $" User: {userId }, Sensor: {sensorId }" );
190190}
191191
@@ -196,7 +196,7 @@ public void GetDeviceMeasurement(WebServerEventArgs e)
196196 string measurementType = e .GetRouteParameter (" type" );
197197
198198 // Example: /api/devices/esp32-001/measurements/temperature
199- WebServer .OutPutStream (e .Context .Response ,
199+ WebServer .OutputAsStream (e .Context .Response ,
200200 $" Device {deviceId } - {measurementType } data" );
201201}
202202```
@@ -223,7 +223,7 @@ public class PersonController
223223 {
224224 string json = JsonConvert .SerializeObject (persons );
225225 e .Context .Response .ContentType = " application/json" ;
226- WebServer .OutPutStream (e .Context .Response , json );
226+ WebServer .OutputAsStream (e .Context .Response , json );
227227 }
228228
229229 [Route (" api/persons/{id}" )]
@@ -238,7 +238,7 @@ public class PersonController
238238 {
239239 string json = JsonConvert .SerializeObject (person );
240240 e .Context .Response .ContentType = " application/json" ;
241- WebServer .OutPutStream (e .Context .Response , json );
241+ WebServer .OutputAsStream (e .Context .Response , json );
242242 }
243243 else
244244 {
@@ -421,7 +421,7 @@ public void GetData(WebServerEventArgs e)
421421 string json = JsonConvert .SerializeObject (data );
422422
423423 e .Context .Response .ContentType = " application/json" ;
424- WebServer .OutPutStream (e .Context .Response , json );
424+ WebServer .OutputAsStream (e .Context .Response , json );
425425}
426426```
427427
@@ -433,7 +433,7 @@ public void GetPage(WebServerEventArgs e)
433433{
434434 string html = " <html><body><h1>Hello nanoFramework!</h1></body></html>" ;
435435 e .Context .Response .ContentType = " text/html" ;
436- WebServer .OutPutStream (e .Context .Response , html );
436+ WebServer .OutputAsStream (e .Context .Response , html );
437437}
438438```
439439
@@ -446,6 +446,6 @@ Bonus point if you read up to here, you can also create your custom status code!
446446public void CustomStatus (WebServerEventArgs e )
447447{
448448 e .Context .Response .StatusCode = 418 ; // I'm a teapot
449- WebServer .OutPutStream (e .Context .Response , " I'm a teapot!" );
449+ WebServer .OutputAsStream (e .Context .Response , " I'm a teapot!" );
450450}
451451```
0 commit comments