vibe.d beta banner
get vibe.d
0.9.0

Asynchronous I/O that doesn’t get in your way, written in D

Function bodyParam

Declare that a parameter will be transmitted to the API through the body.

WebParamAttribute bodyParam (
  string identifier,
  string field
) @safe;

WebParamAttribute bodyParam (
  string identifier
) @safe;

It will be serialized as part of a JSON object. The serialization format is currently not customizable. If no fieldname is given, the entire body is serialized into the object.

Parameters

NameDescription
identifier The name of the parameter to customize. A compiler error will be issued on mismatch.
field The name of the field in the JSON object. ---- @bodyParam("pack", "package") void ship(int pack); // The server will receive the following body for a call to ship(42): // { "package": 42 } ----
Authors

Sönke Ludwig, Михаил Страшун

Copyright

© 2012-2017 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.