From f5fdf698ef863e4d4d0b1b03478c4170637455a6 Mon Sep 17 00:00:00 2001 From: Balakrishnan Balasubramanian Date: Sat, 21 Dec 2024 16:34:12 -0500 Subject: [PATCH] Fix bad example for boolean options --- README.md | 6 +++--- anyhttp_test.go | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8e15909..85bce6f 100644 --- a/README.md +++ b/README.md @@ -17,13 +17,13 @@ Just replace `http.ListenAndServe` with `anyhttp.ListenAndServe`. Syntax - unix?path=&mode=&remove_existing= + unix?path=&mode=&remove_existing= Examples unix?path=relative/path.sock unix?path=/var/run/app/absolutepath.sock - unix?path=/run/app.sock&mode=600&remove_existing=no + unix?path=/run/app.sock&mode=600&remove_existing=false | option | description | default | |-----------------|------------------------------------------------|----------| @@ -35,7 +35,7 @@ Examples Syntax - sysd?idx=&name=&check_pid=&unset_env=&idle_timeout= + sysd?idx=&name=&check_pid=&unset_env=&idle_timeout= Only one of `idx` or `name` has to be set diff --git a/anyhttp_test.go b/anyhttp_test.go index 74f58ad..b6decaa 100644 --- a/anyhttp_test.go +++ b/anyhttp_test.go @@ -72,6 +72,20 @@ func Test_parseAddress(t *testing.T) { wantSysc: nil, wantErr: true, }, + { + name: "systemd address with check_pid and unset_env", + addr: "sysd?idx=0&check_pid=false&unset_env=f", + wantAddrType: SystemdFD, + wantUsc: nil, + wantSysc: &SysdConfig{ + FDIndex: ptr(0), + FDName: nil, + CheckPID: false, + UnsetEnv: false, + IdleTimeout: nil, + }, + wantErr: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {