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 eb9f6ca
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Tests/Foundation/TestURLSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,16 @@ final class TestURLSession: LoopbackServerTest, @unchecked Sendable {
await downloadTaskWithRequestAndHandler(with: session)
}

func downloadTaskWithTruncatedHeaders() async {
let configuration = URLSessionConfiguration.default
let session = URLSession(configuration: configuration)
let url = URL(string: "https://www.prevention.com/health/a46107400/types-of-magnesium/#")!
var request = URLRequest(url: url)
request.setValue("facebookexternalhit/1.1", forHTTPHeaderField: "User-Agent")

let (data, response) = try await session.data(with: url)
}

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 eb9f6ca

Please sign in to comment.