olliNiinivaara / GuildenStern

Modular multithreading HTTP/1.1 + WebSocket server framework
MIT License
80 stars 7 forks source link

example doesn't compile for me #13

Closed ITwrx closed 1 year ago

ITwrx commented 1 year ago

I'm getting a type error when trying to compile the example.

$ nim r --d:release --d:threadsafe example.nim
Hint: used config file '/home/itwrx/.choosenim/toolchains/nim-2.0.0/config/nim.cfg' [Conf]
Hint: used config file '/home/itwrx/.choosenim/toolchains/nim-2.0.0/config/config.nims' [Conf]
Hint: used config file '/var/www/betterweb-guildenstern/betterweb/nim.cfg' [Conf]
......................................................................................................................................................
/var/www/betterweb-guildenstern/betterweb/example.nim(13, 32) Error: type mismatch
Expression: getOrDefault(readData(getBody()), "say")
  [1] readData(getBody()): StringTableRef
  [2] "say": string

Expected one of (first mismatch at [position]):
[1] func getOrDefault(headers: HttpHeaders; key: string;
                  default = @[""].HttpHeaderValues): HttpHeaderValues
olliNiinivaara commented 1 year ago

In previous versions, strtabs was automatically exported to user. But because I want the server to be just a very unmagical and unopinionated building block, I removed such export (you only need StringTableRef with certain header operations). So, the fix is to explicitly import strtabs when required, and I have modified the example accordingly. Need to document this also at some point...