Commit d48a469f authored by Collin Jackson's avatar Collin Jackson

Merge pull request #1389 from collinjackson/contentType

Example of setting the content type of a POST request
parents 340f6fd4 cd95d51c
...@@ -38,8 +38,8 @@ class PostDemoState extends State<PostDemo> { ...@@ -38,8 +38,8 @@ class PostDemoState extends State<PostDemo> {
}); });
http.Response response = await http.post( http.Response response = await http.post(
"http://httpbin.org/post", "http://httpbin.org/post",
body: "asdf=42", body: '{"foo": "bar"}',
headers: { "foo": "bar" } headers: { "Content-Type": "application/json", "baz": "qux" }
); );
setState(() { setState(() {
_response = response.body; _response = response.body;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment