Daniel15 / simple-nuget-server

A very simple PHP NuGet server
MIT License
116 stars 43 forks source link

Change casing of $_GET keys to improve compatibility with VS14 #4

Closed miyu closed 9 years ago

miyu commented 9 years ago

This is necessary because Visual Studio 14 makes requests such as: GET /FindPackagesById()?Id='X.Y.Z' HTTP/1.1

Rather than the expected: GET /FindPackagesById()?id='X.Y.Z' HTTP/1.1

Before: http://puu.sh/dkaRB/2618631e63.png After: http://puu.sh/dkaTa/1b0623abf2.png

miyu commented 9 years ago

As a side-note, I made changes to all entry points that I saw using $_GET.

I don't think anyone will be upset if the code supports ?packageids= (which is nonstandard) as well as ?packageIds=.

Daniel15 commented 9 years ago

Maybe put $_GET = array_change_key_case($_GET, CASE_LOWER); in core.php instead? I'm not really a fan of things that are repeated in multiple files.

miyu commented 9 years ago

Done.

IMO Moving the key transform to core.php hides the solution from where we use $_GET, so the code becomes less self-documenting. Maybe we should have a getter method to abstract this silliness away?

Daniel15 commented 9 years ago

I think this is okay for now, ideally PHP wouldn't have superglobals like $_GET and instead have a nice HTTP abstraction (say something like Symfony's HttpFoundation) but it is what it is. I used PHP because it's simple and everywhere, not because it's a nice language. My server just doesn't have enough RAM to run more than a few Mono instances :P