Skip to content
This repository was archived by the owner on Aug 10, 2024. It is now read-only.

Conversation

@bubudrc
Copy link

@bubudrc bubudrc commented Apr 10, 2023

I have an issue with an url (https://hipertextual.com/feed). Every time that I tried to get the articles, this endpoint redirects, several times to the same url.

This little update help to avoid the problem where the redirect url is the same that the original and returns an error.

if response.statusCode == 301 || response.statusCode == 308 {
if let oldURLString = task.originalRequest?.url?.absoluteString, let newURLString = request.url?.absoluteString {
cacheRedirect(oldURLString, newURLString)
guard oldURLString != newURLString else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you rewrite this as if oldURLString == newURLString {? This would make it easier to understand for future people reading the code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants