2
Nmeri17
6d

It's shockingly bad, Jesus 😣

https://stackoverflow.com/questions...

I know I'm just whining atp instead of moving on something else. For lack of anything else, I blame capitalism for limiting my options. I would never subject myself to this torture of my own volition. Yet, you have to wonder how a joke like this. Even a routing library developed over a code kata or aboard a flight would at least, include a regex capturing possibility of trailing slashes. How would one ever imagine that all clients of this api have to strictly either end their url with slashes, otherwise they get slammed with a 404

Unbelievable

Comments
  • 2
    HTTP doesn't say anything about it but ending with a slash is kinda unwritten rule. But in a framework like aiohttp (python) for examplep; with and without trailing / is accepted.

    I'm sorry to say, but a trailing / is kinda general knowledge imho. An unwritten rule. I also do the trailing slash in my applications.
  • 2
    @retoor I will be surprised if trailing slashes are a spec-level concern. In all my years of internet usage, this is my first time to ever come across a strict demand for adherence to TRAILING SLASHES. The more I contemplate this disease, the weaker I get. This is analogous to the punctuation of a sentence. It is not the path and should be treated separately rather than determining url is nonexistent. As a server, You are not supposed to rely on its presence unless it's followed by other characters. This isn't xml or yml. It's literally TWO extra regex characters to your route parser

    Shameful
  • 1
    @retoor is correct. Spring and Tomcat are anal about their trailing slashes. It's not just those two, in the NodeJS ecosystem you see it too and even more -- the leading slashes (at mapping) make requests' mapping at entirely different paths.
  • 1
    @netikras * screenshot *
  • 1
    Jesus won't help you with anything to do with Java.
  • 1
    @Nmeri17 well, i dunno. At system level, a directory is also visible by having a / at the end where files do not. So for example:

    - cond.d

    - conf.d/

    So i don't think it's a very bad pattern. Else you would have to work with some highlighting. That's worse.

    But finding out about the trailing / also isn't something I found out early. Did years of development before I found out this unwritten rule. But I understand the frustration. So solid rant!
  • 3
    @donkulator strange, they're almost the same age.
  • 2
    @retoor If you use path '/home', then you're referring to the '/home' resource. However, a '/home/' refers to the _root_ ['/'] resource under /home, and not /home itself.

    It makes much semantic sense
  • 2
    @netikras Yes! Exactly! So, what is left to do. Let's make this unwritten rule, a written rule. If a path exists, and it is a file, it's just return by a static file resolver, if it exists, and it is a directory, we'll take the main file of the directory or do a directory listing UNLESS the application has a path specified ending on '/'.

    It reminds me about HTML a bit. Browsers accepting <a href=pony.nl>Pony</a> instead of <a href="pony.nl"></a> are also bastards. If everyone just had sticked to "pony", we wouldn't have the HELL we had in the 2000's. Godddamn, writing three applications in one to support all browsers. Of course you don't do that, you do everything to make it one app. What a time was that. One of the reasons I actually liked Macromedia Flash. At least everything was like I had made. Macromedia was SO AWESOME before Adobe came. Fireworks with its simple effects, I used it like a photoshop. Slicing PNG images and stuff.
  • 1
    @netikras Do you remember that 'slicing' was a term? Who slices? The dev or the designer was the discussion.
  • 1
    @retoor Yes, they are mortal enemies since the dawn of time.
  • 1
    @netikras fair enough. But Such a slight divergence is very easy to miss
Add Comment