Skip to content

Instantly share code, notes, and snippets.

@malcommac
Created March 15, 2022 19:14
Show Gist options
  • Save malcommac/6d3ab17005b40f8299dce9f6b7e0defb to your computer and use it in GitHub Desktop.
Save malcommac/6d3ab17005b40f8299dce9f6b7e0defb to your computer and use it in GitHub Desktop.
let req = HTTPRequest {
$0.url = URL(string: "https://.../login")!
$0.method = .post
$0.timeout = 15
$0.redirectMode = redirect
$0.maxRetries = 4
$0.headers = HTTPHeaders([
.init(name: .userAgent, value: myAgent),
.init(name: "X-API-Experimental", value: "true")
])
// Setup URL query params & body
$0.addQueryParameter(name: "full", value: "1")
$0.addQueryParameter(name: "autosignout", value: "30")
$0.body = .json(["username": username, "pwd": pwd])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment