vaimee / zion

A scalable Thing Description Directory
Apache License 2.0
17 stars 4 forks source link

Trailing slashes not allowed in URLs #7

Open benfrancis opened 2 years ago

benfrancis commented 2 years ago

Just a small thing, and it's probably spec compliant, but this caught me out when I wasn't sure why I kept getting 404 responses.

A GET request on /things works, but a request on /things/ returns a 404.

relu91 commented 2 years ago

Just found out that the Fastify router does not enable by default ignoreTrailingSlashes. We can enable them as described here: https://morioh.com/p/bcdbef588277. However, now I wonder which is the correct behavior. Is it standard to ignore the trailing slashes? Is it something that we should tackle in the WoT Discovery spec?

benfrancis commented 2 years ago

I guess technically there should be a 301 redirect from one to the other. And since /things is what's in the specification, it should probably redrect /things/ to /things. Whether or not WoT Consumers will follow the redirect is another matter, though that's another good reason not to disallow redirect responses!

We sidestep this kind of issue in the protocol bindings in WoT Profile by not specifying hard coded paths, which is what I personally think WoT Discovery should have done. But given it does specifiy paths, it might have to deal with issues like this more explicitly.