浏览代码

Add tests for #273.

Damian Kołakowski 8 年之前
父节点
当前提交
5cc1795047
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      XCode/SwifterTestsCommon/SwifterTestsHttpParser.swift

+ 3 - 0
XCode/SwifterTestsCommon/SwifterTestsHttpParser.swift

@@ -99,6 +99,9 @@ class SwifterTestsHttpParser: XCTestCase {
         r = try? parser.readHttpRequest(TestSocket("POST / HTTP/1.0\nContent-Length: 10\n\n1234567890"))
         r = try? parser.readHttpRequest(TestSocket("POST / HTTP/1.0\nContent-Length: 10\n\n1234567890"))
         XCTAssertEqual(r?.method, "POST", "Parser should extract HTTP method name from the status line.")
         XCTAssertEqual(r?.method, "POST", "Parser should extract HTTP method name from the status line.")
         
         
+        r = try? parser.readHttpRequest(TestSocket("GET / HTTP/1.0\nHeader1: 1:1:34\nHeader2: 12345\nContent-Length: 0\n\n"))
+        XCTAssertEqual(r?.headers["header1"], "1:1:34", "Parser should properly extract header name and value in case the value has ':' character.")
+        
         r = try? parser.readHttpRequest(TestSocket("GET / HTTP/1.0\nHeader1: 1\nHeader2: 2\nContent-Length: 0\n\n"))
         r = try? parser.readHttpRequest(TestSocket("GET / HTTP/1.0\nHeader1: 1\nHeader2: 2\nContent-Length: 0\n\n"))
         XCTAssertEqual(r?.headers["header1"], "1", "Parser should extract multiple headers from the request.")
         XCTAssertEqual(r?.headers["header1"], "1", "Parser should extract multiple headers from the request.")
         XCTAssertEqual(r?.headers["header2"], "2", "Parser should extract multiple headers from the request.")
         XCTAssertEqual(r?.headers["header2"], "2", "Parser should extract multiple headers from the request.")