You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by oc...@apache.org on 2023/01/28 02:02:53 UTC
[trafficcontrol-trafficops-types] 01/02: add support for null protocols to protocolToString
This is an automated email from the ASF dual-hosted git repository.
ocket8888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol-trafficops-types.git
commit d46dd9c6428c04ff9ce09380a732e9f6fa1dc53a
Author: ocket8888 <oc...@apache.org>
AuthorDate: Fri Jan 27 19:01:44 2023 -0700
add support for null protocols to protocolToString
---
src/delivery.service.ts | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/delivery.service.ts b/src/delivery.service.ts
index 89111df..c3e73ef 100644
--- a/src/delivery.service.ts
+++ b/src/delivery.service.ts
@@ -82,9 +82,9 @@ export const enum Protocol {
* Converts Protocols to a textual representation.
*
* @param p The Protocol to convert.
- * @returns A string representation of 'p', or 'UNKNOWN' if 'p' was unrecognized.
+ * @returns A string representation of 'p', or a blank string if 'p' was null.
*/
-export function protocolToString(p: Protocol): string {
+export function protocolToString(p: Protocol | null): string {
switch (p) {
case Protocol.HTTP:
return "Serve only unsecured HTTP requests";
@@ -95,6 +95,7 @@ export function protocolToString(p: Protocol): string {
case Protocol.HTTP_TO_HTTPS:
return "Serve secured HTTPS requests normally, but redirect unsecured HTTP requests to use HTTPS";
}
+ return "";
}
/**