fix: add routes to get routing ports & all defined routes#1228
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds two new Web API request handlers to improve route interrogation capabilities: one for retrieving routing ports associated with a device, and another for listing all defined routes. Additionally, an existing route name has been updated and the protocol for generating URL paths has been changed to HTTPS.
- Added GetRoutingPortsHandler to respond to device routing port requests.
- Added GetRoutesHandler to expose the current route collection via a new "apiPaths" endpoint.
- Updated route “getTielines” to “tielines” and enforced HTTPS in URL generation.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/PepperDash.Essentials.Core/Web/RequestHandlers/GetRoutingPortsHandler.cs | New handler to fetch and return routing port details for a specified device. |
| src/PepperDash.Essentials.Core/Web/RequestHandlers/GetRoutesHandler.cs | New handler to serialize and return the route collection. |
| src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs | Updated routing configuration by changing an existing route name, adding new routes, and forcing HTTPS for generated URLs. |
Comments suppressed due to low confidence (2)
src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs:259
- Forcing the HTTPS protocol may cause issues in environments that require HTTP. Consider making the protocol configurable based on the deployment context.
? "$https://{hostname}/VirtualControl/Rooms/{InitialParametersClass.RoomId}/cws{BasePath}"
src/PepperDash.Essentials.Core/Web/RequestHandlers/GetRoutesHandler.cs:20
- The response content type is set both via the ContentType property and by adding a header explicitly. Consider removing the redundant header assignment to avoid potential conflicts.
context.Response.Headers.Add("Content-Type", "application/json");
There was a problem hiding this comment.
Pull Request Overview
This pull request adds two new web API request handlers to support fetching routing ports for a device and retrieving all defined routes. It also updates the route configurations in the EssentialsWebApi to integrate the new endpoints and standardizes URL usage to HTTPS.
- Introduces GetRoutingPortsHandler to return input/output port keys for a device.
- Introduces GetRoutesHandler to return route information including the base URL.
- Updates the EssentialsWebApi route definitions to include the new endpoints and adjust existing routes.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/PepperDash.Essentials.Core/Web/RequestHandlers/GetRoutingPortsHandler.cs | Added handler to fetch routing ports based on deviceKey |
| src/PepperDash.Essentials.Core/Web/RequestHandlers/GetRoutesHandler.cs | Added handler to return API route details |
| src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs | Updated route configuration with new endpoints and HTTPS URL formatting |
Comments suppressed due to low confidence (1)
src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs:208
- [nitpick] Consider renaming the 'apiPaths' route to a term like 'routes' to better reflect its purpose and maintain consistency with other endpoint naming conventions.
AddRoute(new HttpCwsRoute("apiPaths") {
No description provided.