我正在迅速编写一个HTTP Post,在正文中有一个字典,其字符串值为“ djaskd / ffk”。
当我更改“ /”字符时,它的工作原理但是我需要这个“ /”。如何在http正文中使用“ /”字符。
let session = URLSession.shared
var request = URLRequest(url:post_url)
request.httpMethod = "POST"
request.setValue("application/json; charset=utf-81", forHTTPHeaderField:"ContentType")
request.addValue("application/json" forHTTPHeaderField:"Accept")
let parameters = NSMutableDictionary()
parameters.setValue("sfala/4nv", forKey:"key")
request.httpBody = try JSONSerilization.data(withJSONObject:parameters, options .prettyPrinted)
谢谢
答案 0 :(得分:0)
我已经尝试过
BitLocker Drive Encryption: Configuration Tool version 10.0.18362
Copyright (C) 2013 Microsoft Corporation. All rights reserved.
ERROR: An attempt to access a required resource was denied.
Check that you have administrative rights on the computer.
nd控制台打印
let session = URLSession.shared
var request = URLRequest(url: URL(string: "url")!)
request.httpMethod = "POST"
request.setValue("application/json; charset=utf-81", forHTTPHeaderField: "ContentType")
request.addValue("application/json", forHTTPHeaderField: "Accept")
let parameters = NSMutableDictionary()
parameters.setValue("sfala/4nv", forKey: "key")
let asd = try JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted)
request.httpBody = asd
print(String(data: asd, encoding: String.Encoding.utf8)!)
确保您做对了所有事情。