I don't think this will fix the reported issue. The path in the request URL doesn't seem to be included.
Can we use this constructor: URL(URL context, String spec)