haxetink / tink_web

Tinkerbell Web Framework
https://haxetink.github.io/tink_web
43 stars 14 forks source link

compiling body parameter #121

Closed gamedevbynight closed 3 years ago

gamedevbynight commented 3 years ago

I have problems getting the body of the request. When I try to compile the example from the docs I get errors:

C:\HaxeToolkit\haxe\lib\tink_querystring/git/src/tink/querystring/macros/GenParser.hx:121: characters 26-33 : error: Cannot unify final and non-final fields C:\HaxeToolkit\haxe\lib\tink_querystring/git/src/tink/querystring/macros/GenParser.hx:121: characters 26-33 : ... have: ({ name: Dynamic }) -> ... C:\HaxeToolkit\haxe\lib\tink_querystring/git/src/tink/querystring/macros/GenParser.hx:121: characters 26-33 : ... want: ({ name: Dynamic }) -> ... C:\HaxeToolkit\haxe\lib\tink_querystring/git/src/tink/querystring/macros/GenParser.hx:121: characters 26-33 : ... For function argument 'name'

I'm using Haxe 4.2.1

And that is my very small example.

import tink.http.containers.*;
import tink.http.Response;
import tink.web.routing.*;

class Server {
    static function main() {
        var container = new NodeContainer(8080);
        var router = new Router<Root>(new Root());
        container.run(function(req) {
            return router.route(Context.ofRequest(req)).recover(OutgoingResponse.reportError);
        });
    }
}

class Root {
    public function new() {}
    @:post
    public function create(body:{name:String}) {
        return "Hello";
    }
}
kevinresol commented 3 years ago

Can't reproduce on my side. What is your tink_querystring revision?

gamedevbynight commented 3 years ago

My revision for tink_querystring is 8eee7f83e2f60606415ff09062423117ff839056

gamedevbynight commented 3 years ago

installed everything on a new machine. Got the same error. Installed everything with haxelib git command

back2dos commented 3 years ago

The sample compiles with haxe 4.2. and latest haxelib releases:

> haxelib list
http-status: [1.3.1]
hxnodejs: [12.1.0]
tink_anon: [0.7.0]
tink_chunk: [0.4.0]
tink_core: [2.0.2]
tink_http: [0.10.0]
tink_io: [0.9.0]
tink_json: [0.11.0]
tink_macro: [0.24.0]
tink_querystring: [0.7.0]
tink_streams: [0.4.0]
tink_stringly: [0.5.0]
tink_typecrawler: [0.7.0]
tink_url: [0.5.0]
tink_web: [0.3.0]