svenvc / zinc

Zinc HTTP Components is an open-source Smalltalk framework to deal with the HTTP networking protocol.
MIT License
97 stars 57 forks source link

Static file server gives error on URL with query at website root #150

Open FunctionPoint opened 2 months ago

FunctionPoint commented 2 months ago

Start with a fresh Pharo 13 image. In a Playground window evaluate:

(ZnServer startDefaultOn: 3000)
    delegate: ( ZnStaticFileServerDelegate new
    directory: 'web' asFileReference;
    yourself).

Where the "web" subfolder contains some basic "index.html" file.

In a browser, browse to: "localhost:3000" and the website is shown correctly.

Now browse to "localhost:3000/?test" and the following error is shown: "PrimitiveFailed: primitive #basicNew: in Array class failed" . Expected behavior: The website is shown correctly and the "?test" argument can be retrieved with JavaScript: Windows.location.search.

FunctionPoint commented 2 months ago

Checking further: The error only occurs when the query is at the root level. For example "localhost:3000/index.html?test" does not give an error and shows the website. That will be the workaround.. :)