Example of setting the content type of a POST request

This commit is contained in:
Collin Jackson 2016-01-26 12:24:01 -08:00
parent 7737117a20
commit cd95d51c70

View File

@ -38,8 +38,8 @@ class PostDemoState extends State<PostDemo> {
});
http.Response response = await http.post(
"http://httpbin.org/post",
body: "asdf=42",
headers: { "foo": "bar" }
body: '{"foo": "bar"}',
headers: { "Content-Type": "application/json", "baz": "qux" }
);
setState(() {
_response = response.body;