v
v copied to clipboard
vweb path is mixed case, return 404
V version: V 0.3.0 0d6d6f7 OS: ubuntu 18.04
What did you do?
import vweb
struct T1App {
vweb.Context
pub:
a string
}
['/aB']
pub fn (mut app T1App) hello() vweb.Result {
return app.text(app.a)
}
fn main() {
app := T1App{
a: "this is a test"
}
println(app.a)
vweb.run(&app, 18082)
}
curl -v http://localhost:18082/aB What did you expect to see?
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 18082 (#0)
> GET /aB HTTP/1.1
> Host: localhost:18082
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200
< Content-Type: text/plain
< Server: VWeb
< Connection: close
< Content-Length: 14
<
* Closing connection 0
What did you see instead?
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 18082 (#0)
> GET /aB HTTP/1.1
> Host: localhost:18082
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Content-Type: text/plain
< Server: VWeb
< Connection: close
< Content-Length: 13
<
* Closing connection 0
VWeb automatically converts all paths defined in the code to lowercase. And any incoming request url isn't transformed to lowercase that is why the cases don't match and VWeb can't find a path.
Linux is case sensitive in is file system, have you tried it on Windows?
Aside from that, in my opinion lowercase is more user accessible, but mixed cases would be helpful when creating pretty url's for example.
Also wondering if matching url case is something VWeb should handle or the server on which the application runs (apache etc).