Skip to content

Commit

Permalink
Add crashing example test
Browse files Browse the repository at this point in the history
  • Loading branch information
harlanhaskins committed Feb 8, 2025
1 parent 13245b4 commit 83c610e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Tests/Foundation/TestURLSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,18 @@ final class TestURLSession: LoopbackServerTest, @unchecked Sendable {
await downloadTaskWithRequestAndHandler(with: session)
}

func downloadTaskWithTruncatedHeaders() async {
let configuration = URLSessionConfiguration.default
let session = URLSession(configuration: configuration)

// url1 works
let url1 = URL(string: "https://github.com/IBM-Swift/CArchive/raw/master/module.modulemap")!
//url2 generates a Fatal error
let url2 = URL(string: "https://store-test.blobstore.apple.com/test2/think.txt?AWSAccessKeyId=MKIAQ46TEN6NTFP8PJAP&SignatureMethod=HmacSHA1&SignatureVersion=2&Expires=64092211200&Signature=jgHl7aTtiJhkvSaRC19YaH2T2qo%3D")!

let (data, response) = try await session.data(from: url2)
}

func downloadTaskWithRequestAndHandler(with session: URLSession) async {
let urlString = "http://127.0.0.1:\(TestURLSession.serverPort)/country.txt"
let expect = expectation(description: "Download GET \(urlString): with a completion handler")
Expand Down

0 comments on commit 83c610e

Please sign in to comment.