Преглед на файлове

update changelog & fix invalid test

* added `update` entries to CHANGELOG.md describing fixed parsing & new test
* fix invalid test, don't need the full domain in parser
* ran `swift test --generate-linuxmain`
Nejc Vivod преди 7 години
родител
ревизия
3c3663bcb6
променени са 3 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 2 0
      CHANGELOG.md
  2. 1 1
      XCode/Tests/SwifterTestsHttpParser.swift
  3. 1 0
      XCode/Tests/XCTestManifests.swift

+ 2 - 0
CHANGELOG.md

@@ -25,6 +25,8 @@ All notable changes to this project will be documented in this file. Changes not
 ## Changed
 
 - Set the version of the HTTP Server based in the project version in the **Info.plist** for macOS, iOS and tvOS platforms. ([#416](https://github.com/httpswift/swifter/pull/416)) by [@Vkt0r](https://github.com/Vkt0r)
+- Update `HttpParser` so it percent-encodes the URL components before initializing `URLComponents`
+- Update `SwifterTestsHttpParser` with a test for parsing bracketed query strings
 
 # [1.4.7] 
 

+ 1 - 1
XCode/Tests/SwifterTestsHttpParser.swift

@@ -166,7 +166,7 @@ class SwifterTestsHttpParser: XCTestCase {
         XCTAssertEqual(resp?.headers["header1"], "1", "Parser should extract multiple headers from the request.")
         XCTAssertEqual(resp?.headers["header2"], "2", "Parser should extract multiple headers from the request.")
 
-        resp = try? parser.readHttpRequest(TestSocket("GET https://www.example.com/some/path?subscript_query[]=1&subscript_query[]=2 HTTP/1.0\nContent-Length: 10\n\n1234567890"))
+        resp = try? parser.readHttpRequest(TestSocket("GET /some/path?subscript_query[]=1&subscript_query[]=2 HTTP/1.0\nContent-Length: 10\n\n1234567890"))
         let queryPairs = resp?.queryParams ?? []
         XCTAssertEqual(queryPairs.count, 2)
         XCTAssertEqual(queryPairs.first?.0, "subscript_query[]")

+ 1 - 0
XCode/Tests/XCTestManifests.swift

@@ -97,6 +97,7 @@ extension SwifterTestsWebSocketSession {
 
 public func __allTests() -> [XCTestCaseEntry] {
     return [
+        testCase(IOSafetyTests.__allTests__IOSafetyTests),
         testCase(MimeTypeTests.__allTests__MimeTypeTests),
         testCase(ServerThreadingTests.__allTests__ServerThreadingTests),
         testCase(SwifterTestsHttpParser.__allTests__SwifterTestsHttpParser),