提交 63fce12f 编写于 作者: C Christian Noon

Fixed content type validation issue where parameter parsing was incorrect.

上级 2beb1e3b
......@@ -94,7 +94,7 @@ extension Request {
init?(_ string: String) {
let components: [String] = {
let stripped = string.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())
let split = stripped.substringToIndex(stripped.rangeOfString(";")?.endIndex ?? stripped.endIndex)
let split = stripped.substringToIndex(stripped.rangeOfString(";")?.startIndex ?? stripped.endIndex)
return split.componentsSeparatedByString("/")
}()
......
......@@ -116,6 +116,8 @@ class ContentTypeValidationTestCase: BaseTestCase {
// When
Alamofire.request(.GET, URLString)
.validate(contentType: ["application/json"])
.validate(contentType: ["application/json;charset=utf8"])
.validate(contentType: ["application/json;q=0.8;charset=utf8"])
.response { _, _, _, responseError in
error = responseError
expectation.fulfill()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册