dartist / express

A thin express-js inspired layer around Dart's primitive HttpServer APIs
Other
126 stars 11 forks source link

How to get the posted data? #6

Closed freewind closed 10 years ago

freewind commented 11 years ago

I mean a form in HTML:

<form method="post">
<input type="text" name="title" />
<input type="submit" />
</form>

How to get the value of posted title?

mythz commented 11 years ago

Unfortunately Dart's HttpRequest doesn't provide an option for this, so it's something we'd need to bake inside of the framework ourselves.

I'll leave this open as a feature request.

SamVerschueren commented 10 years ago

I will make a pull request for this. I managed to get the post data as map quite easily. Will do something like this

app.post('/form', (ctx) {
    print(ctx.body['title']);
});

So ctx.body is a map (key-value pair) holding the name as key and offcourse the content of the field as value.