Closed brendanlensink closed 2 years ago
which is already a little weird
I mean, it shouldn't seem so weird once you've encountered the problems with using .default
😄. The problems you list are basically why it's like that.
Probably we should either have the init just take a timeout, or if we wanted to future proof it a little, a small struct Config { var timeout: TimeInterval? }
so if there is actually some other stuff it turns out we want to configure we can add it without changing the signature of init.
By default, the Netable constructor creates an emphemeral NSURLSessionConfiguration instead of default, which is already a little weird.
Using default also means that some requests are cached by default, which can lead to some weird bugs where network requests don't send updated information when they should.
I'm not sure if there's really much we can do here, but I was accidentally creating Netable instances with
Netable(configuration: .default)
expecting it to be the vanilla option and then running into bugs with network requests, which seems like a pretty bad experience.At the very least we should add some documentation to the Netable constructor noting this quirk, or come up with a better way to pass in configurations to avoid this.