Upload to Stream in Swift - Decoding error

I am recording a video on the device (< 200 MB), and then trying to upload it with the direct upload link for creators. It works in curl, but in swift I get an error on decoding. My code looks like this. What is wrong?

func uploadIntro()
{
    
    var request = URLRequest(url: URL(string:self.uploadUrl)!)
    request.httpMethod = "POST"
    
    let fm = FileManager.default
    let docsurl = try! fm.url(for:.documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
    
    guard let fileToUpload = try? docsurl.appendingPathComponent("video.mov")
            else
    {
        fatalError("Failed to locate video in bundle.")
    }
    let body = try! Data(contentsOf: fileToUpload)
    let uploadTask = URLSession.shared.uploadTask(with: request, from: body) {data, response, error in
        guard error == nil else { print(error!.localizedDescription); return }
        guard let data = data else { print("Empty data"); return }
        if let str = String(data: data, encoding: .utf8) {
            print(str)
        }
    }
    uploadTask.resume()
}

Below is the response I see in the X Code console:
ptional(<NSHTTPURLResponse: 0x2813c95a0> { URL: https://upload.videodelivery.net/ } { Status Code: 400, Headers {
“Access-Control-Allow-Origin” = (
“*”
);
“Cache-Control” = (
private
);
“Content-Type” = (
“text/plain; charset=utf-8”
);
Date = (
“Mon, 30 Jan 2023 08:43:32 GMT”
);
Server = (
Cloudflare
);
“Strict-Transport-Security” = (
“max-age=15552000”
);
Vary = (
“Accept-Encoding”
);
“access-control-allow-headers” = (
“X-Requested-With, Content-Type”
);
“access-control-allow-methods” = (
“GET, POST”
);
“access-control-expose-header” = (
“cf-ray”
);
“cf-cache-status” = (
DYNAMIC
);
“cf-ray” = (
“7918eb970f4f2d92-ARN”
);
“served-in-seconds” = (
“0.016”
);
“stream-dw-version” = (
“2023.1.14”
);
} })

From your response it seems like the uploadUrl isn’t formed properly.