From 241c4581840090aa6c81d3cee7547daf1c14228f Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 10 Sep 2019 15:26:37 +0200 Subject: [PATCH] cli: Print out available tus extensions --- cmd/tusd/cli/serve.go | 2 +- pkg/handler/unrouted_handler.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/tusd/cli/serve.go b/cmd/tusd/cli/serve.go index 522ccb9..c5bc869 100644 --- a/cmd/tusd/cli/serve.go +++ b/cmd/tusd/cli/serve.go @@ -54,7 +54,7 @@ func Serve() { SetupHookMetrics() } - stdout.Printf(Composer.Capabilities()) + stdout.Printf("Supported tus extensions: %s\n", handler.SupportedExtensions()) // Do not display the greeting if the tusd handler will be mounted at the root // path. Else this would cause a "multiple registrations for /" panic. diff --git a/pkg/handler/unrouted_handler.go b/pkg/handler/unrouted_handler.go index 6312253..938ff2e 100644 --- a/pkg/handler/unrouted_handler.go +++ b/pkg/handler/unrouted_handler.go @@ -155,6 +155,13 @@ func NewUnroutedHandler(config Config) (*UnroutedHandler, error) { return handler, nil } +// SupportedExtensions returns a comma-separated list of the supported tus extensions. +// The availability of an extension usually depends on whether the provided data store +// implements some additional interfaces. +func (handler *UnroutedHandler) SupportedExtensions() string { + return handler.extensions +} + // Middleware checks various aspects of the request and ensures that it // conforms with the spec. Also handles method overriding for clients which // cannot make PATCH AND DELETE requests. If you are using the tusd handlers