Last active
September 11, 2022 01:38
-
-
Save h2non/6b2ae4f532349b552cb6 to your computer and use it in GitHub Desktop.
JSON POST example with Alamofire
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let parameters = [ | |
"username": "foo", | |
"password": "123456" | |
] | |
Alamofire.request(.POST, "https://httpbin.org/post", parameters: parameters, encoding: .JSON) | |
// -> HTTP body: {"foo": [1, 2, 3], "bar": {"baz": "qux"}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
encoding: JSONEncoding.default, for swift 4