spry_urlencoded 1.0.0 copy "spry_urlencoded: ^1.0.0" to clipboard
spry_urlencoded: ^1.0.0 copied to clipboard

discontinuedreplaced by: spry

The package provides a middleware and extension for Spry to parse application/x-www-form-urlencoded request body.

Spry Urlencoded #

The spry_urlencoded package provides a middleware and extension for Spry to parse application/x-www-form-urlencoded request body.

Pub version

Installation #

Add spry_urlencoded to your pubspec.yaml:

dependencies:
  spry_urlencoded: latest

Or install it from the command line:

dart pub add spry_urlencoded

Usage #

Read the request.urlencoded property to get the parsed body:

import 'package:spry_urlencoded/spry_urlencoded.dart';

void handler(Context context) async {
  print(await context.request.urlencoded());
}

Configuration #

The Urlencoded middleware can be configured with the following options:

  • encoding - The encoding of the request body. Defaults to utf8.
import 'package:spry/spry.dart';
import 'package:spry_urlencoded/spry_urlencoded.dart';

void handler(Context context) async {
  final Map<String, String> urlencoded = await context.request.urlencoded();

  print(urlencoded);
}

final spry = Spry();
final urlencoded = Urlencoded(
  string: utf8,
  part: utf8,
);

spry.use(urlencoded);

await spry.listen(handler, port: 3000);

Note: The Urlencoded middleware is optional. You can use the request.urlencoded extension method to parse the request body.

0
likes
140
points
2
downloads

Publisher

verified publisherodroe.com

Weekly Downloads

The package provides a middleware and extension for Spry to parse application/x-www-form-urlencoded request body.

Documentation

API reference

License

MIT (license)

Dependencies

spry

More

Packages that depend on spry_urlencoded