Example of setting the content type of a POST request
This commit is contained in:
parent
7737117a20
commit
cd95d51c70
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user