dart-lang / shelf

Web server middleware for Dart
https://pub.dev/packages/shelf
BSD 3-Clause "New" or "Revised" License
929 stars 125 forks source link

implement body parsing similar to http_server package #34

Open DartBot opened 9 years ago

DartBot commented 9 years ago

Issue by Andersmholmgren Originally opened as dart-lang/sdk#20160


Shelf currently only exposes the body as a string or byte stream.

http_server provided a sophisticated parser of the body in relation to the request headers content type.

A similar function is sorely missing from shelf

DartBot commented 9 years ago

Comment by sethladd


Is this a suggestion for a new shelf_ plugin, or behavior in shelf itself?


Removed Type-Defect label. Added Type-Enhancement, Pkg-Shelf, Area-Pkg, Triaged labels.

DartBot commented 9 years ago

Comment by Andersmholmgren


Actually upon reflection maybe this is best left to the community.

Something like shelf_body that provides these transformations of the body.

It's certainly a common requirement though to transform the body based on the accept headers etc

DartBot commented 9 years ago

Comment by nex3


I think it's reasonable to add this functionality to the shelf Request class. In general, that class is allowed to expose more-parsed (generally lazily-parsed) views of the request data.

DartBot commented 9 years ago

Comment by Andersmholmgren


Good point. That would be a good home for it