From cc92430e691df5e3b6f5baaa003dfd43e481e3e7 Mon Sep 17 00:00:00 2001 From: Tobias Gesellchen Date: Sat, 4 Apr 2026 18:48:10 +0200 Subject: [PATCH] Add /blacklist handler --- cmd/soundtouch-service/main.go | 4 ++++ cmd/soundtouch-service/testdata/router_routes.txt | 1 + tests/interactions_20260328-103522-477978.md | 8 ++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/soundtouch-service/main.go b/cmd/soundtouch-service/main.go index aefc7f5..8846e92 100644 --- a/cmd/soundtouch-service/main.go +++ b/cmd/soundtouch-service/main.go @@ -780,6 +780,10 @@ func setupRouter(server *handlers.Server) *chi.Mux { r.Route("/v1", func(r chi.Router) { r.Post("/stapp/{deviceId}", server.HandleAppEvents) r.Post("/scmudc/{deviceId}", server.HandleAppEvents) + // Return 405 Method Not Allowed as the upstream behavior also returns 405 + r.Get("/blacklist/{deviceId}", func(w http.ResponseWriter, _ *http.Request) { + w.WriteHeader(http.StatusMethodNotAllowed) + }) }) r.Route("/mgmt", func(r chi.Router) { diff --git a/cmd/soundtouch-service/testdata/router_routes.txt b/cmd/soundtouch-service/testdata/router_routes.txt index 3af7bb3..1797a50 100644 --- a/cmd/soundtouch-service/testdata/router_routes.txt +++ b/cmd/soundtouch-service/testdata/router_routes.txt @@ -63,6 +63,7 @@ GET /streaming/device_setting/account/{account}/device/{device}/device_sett GET /streaming/software/update/account/{account} handlers.(*Server).HandleMargeSoftwareUpdate-fm GET /streaming/sourceproviders handlers.(*Server).HandleMargeSourceProviders-fm GET /updates/soundtouch handlers.(*Server).HandleMargeSoftwareUpdate-fm +GET /v1/blacklist/{deviceId} setupRouter GET /web/* setupRouter.(*Server).HandleWeb HEAD /oauth/* handlers.(*Server).HandleBoseProxy-fm OPTIONS /oauth/* handlers.(*Server).HandleBoseProxy-fm diff --git a/tests/interactions_20260328-103522-477978.md b/tests/interactions_20260328-103522-477978.md index 1af0305..e672807 100644 --- a/tests/interactions_20260328-103522-477978.md +++ b/tests/interactions_20260328-103522-477978.md @@ -67,8 +67,8 @@ Interactions for `20260328-103522-477978/`: | 0063 | mirror | ☑ | GET /streaming/account/{{accountId}}/device/{{device_id}}/group/ | 200 OK | ./mirror/streaming/account/{accountId}/device/{device_id}/group/0063-20260328-105138.464-GET.http | | 0064 | mirror | ☑ | POST /streaming/support/customersupport | 200 OK | ./mirror/streaming/support/customersupport/0064-20260328-105138.499-POST.http | | 0065 | mirror | ☑ | GET /streaming/account/{{accountId}}/provider_settings | 200 OK | ./mirror/streaming/account/{accountId}/provider_settings/0065-20260328-105138.554-GET.http | -| 0066 | upstream | | GET https://events.api.bosecm.com/v1/blacklist/{{device_id}} | 405 Method Not Allowed | ./upstream/v1/blacklist/{device_id}/0066-20260328-105138.587-GET.http | -| 0067 | self | | GET /v1/blacklist/{{device_id}} | 405 Method Not Allowed | ./self/v1/blacklist/{device_id}/0067-20260328-105138.588-GET.http | +| 0066 | upstream | ☑ | GET https://events.api.bosecm.com/v1/blacklist/{{device_id}} | 405 Method Not Allowed | ./upstream/v1/blacklist/{device_id}/0066-20260328-105138.587-GET.http | +| 0067 | self | ☑ | GET /v1/blacklist/{{device_id}} | 405 Method Not Allowed | ./self/v1/blacklist/{device_id}/0067-20260328-105138.588-GET.http | | 0068 | self | ☑ | GET /streaming/device/{{device_id}}/streaming_token | 200 OK | ./self/streaming/device/{device_id}/streaming_token/0068-20260328-105138.703-GET.http | | 0069 | self | ☑ | GET / | 200 OK | ./self/root/0069-20260328-105138.868-GET.http | | 0070 | self | ☑ | GET /streaming/software/update/account/{{accountId}} | 200 OK | ./self/streaming/software/update/account/{accountId}/0070-20260328-105139.565-GET.http | @@ -79,8 +79,8 @@ Interactions for `20260328-103522-477978/`: | 0075 | self | | GET /streaming/account/{{accountId}}/full | 200 OK | ./self/streaming/account/{accountId}/full/0075-20260328-105140.030-GET.http | | 0076 | mirror | | GET /streaming/account/{{accountId}}/full | 200 OK | ./mirror/streaming/account/{accountId}/full/0076-20260328-105140.172-GET.http | | 0077 | self | ☑ | GET /updates/soundtouch?serialnumber=_serial_ | 200 OK | ./self/updates/soundtouch/0077-20260328-105140.196-GET.http | -| 0078 | upstream | | GET https://events.api.bosecm.com/v1/blacklist/{{device_id}} | 405 Method Not Allowed | ./upstream/v1/blacklist/{device_id}/0078-20260328-105146.094-GET.http | -| 0079 | self | | GET /v1/blacklist/{{device_id}} | 405 Method Not Allowed | ./self/v1/blacklist/{device_id}/0079-20260328-105146.094-GET.http | +| 0078 | upstream | ☑ | GET https://events.api.bosecm.com/v1/blacklist/{{device_id}} | 405 Method Not Allowed | ./upstream/v1/blacklist/{device_id}/0078-20260328-105146.094-GET.http | +| 0079 | self | ☑ | GET /v1/blacklist/{{device_id}} | 405 Method Not Allowed | ./self/v1/blacklist/{device_id}/0079-20260328-105146.094-GET.http | | 0080 | self | ☑ | POST /v1/scmudc/{{device_id}} | 200 OK | ./self/v1/scmudc/{device_id}/0080-20260328-105146.457-POST.http | | 0081 | mirror | ☑ | POST /v1/scmudc/{{device_id}} | 200 OK | ./mirror/v1/scmudc/{device_id}/0081-20260328-105146.867-POST.http | | 0082 | self | ☑ | POST /v1/scmudc/{{device_id}} | 200 OK | ./self/v1/scmudc/{device_id}/0082-20260328-105148.464-POST.http |