Posts from July 2020
HTTP in Swift, Part 14: OAuth Setup
While Basic Access authentication works for “basic” cases, it is far more common these days to see some form of OAuth used instead. There are some interesting advantages that OAuth has over Basic authentication, such as:
HTTP in Swift, Part 13: Basic Authentication
HTTP requests to web apis frequently need to have some sort of credential to go with them. The simplest kind of authentication is Basic Access authentication, and in this post we’ll be adding this feature to our library.
HTTP in Swift, Part 12: Retrying
Most networking libraries have the ability to automatically send a request again if the received response wasn’t quite what the client was looking for. Let’s add that to our library as well.
HTTP in Swift, Part 11: Throttling
I once worked on an app that used a
Timer
to periodically ping a server with a status update. In one build of the app, we noticed that the status server started experiencing CPU spikes, eventually culminating in it not being able to handle any more requests.HTTP in Swift, Part 10: Cancellation
Cancelling an in-progress request is an important feature of any networking library, and it’s something we’ll want to support in this framework as well.
HTTP in Swift, Part 9: Resetting
There are a couple remaining changes we need to make to our loading interface, and one of them is to allow resetting.
HTTP in Swift, Part 8: Request Options
So far we’ve written enough code to describe a chain of
HTTPLoader
instances that can process an incomingHTTPRequest
and eventually produce anHTTPResult
.HTTP in Swift, Part 7: Dynamically Modifying Requests
In this post, we’ll be creating an
HTTPLoader
subclass that will allow us to dynamically modify requests.HTTP in Swift, Part 6: Chaining Loaders
So far, the
HTTPLoading
types we’ve created have all been loaders that directly respond to anHTTPRequest
. In order to create new kinds of loaders, we’ll need to revisit theHTTPLoading
protocol.HTTP in Swift, Part 5: Testing and Mocking
We’ve seen how a single method can provide the basis for loading a request over the network.
HTTP in Swift, Part 4: Loading Requests
Up until now, we’ve been looking at the structure and implementation of a simple request/response model. Now it’s time to talk about how we send requests and receive responses.