Skip to content

Commit eb9f6ca

Browse files
committed
Add crashing example test
1 parent 13245b4 commit eb9f6ca

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Tests/Foundation/TestURLSession.swift

+10
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,16 @@ final class TestURLSession: LoopbackServerTest, @unchecked Sendable {
283283
await downloadTaskWithRequestAndHandler(with: session)
284284
}
285285

286+
func downloadTaskWithTruncatedHeaders() async {
287+
let configuration = URLSessionConfiguration.default
288+
let session = URLSession(configuration: configuration)
289+
let url = URL(string: "https://www.prevention.com/health/a46107400/types-of-magnesium/#")!
290+
var request = URLRequest(url: url)
291+
request.setValue("facebookexternalhit/1.1", forHTTPHeaderField: "User-Agent")
292+
293+
let (data, response) = try await session.data(with: url)
294+
}
295+
286296
func downloadTaskWithRequestAndHandler(with session: URLSession) async {
287297
let urlString = "http://127.0.0.1:\(TestURLSession.serverPort)/country.txt"
288298
let expect = expectation(description: "Download GET \(urlString): with a completion handler")

0 commit comments

Comments
 (0)